Consul with SMF on Solaris
Whilst setting up consul on SmartOS I noticed the packages distributed through pkgsrc were lagging behind a bit and the upstream “distribution” contains only the consul binary.
Running consul -dev in a tmux window will get boring pretty quickly, so I came up with the following SMF manifest using manifold which supports start, stop and refresh (triggers a configuration reload):
<?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <!– Created by Manifold –> <service_bundle type="manifest" name="consul"> <service name="site/consul" type="service" version="1"> <create_default_instance enabled="true"/> <single_instance/> <dependency name="network" grouping="require_all" restart_on="error" type="service"> <service_fmri value="svc:/milestone/network:default"/> </dependency> <dependency name="filesystem" grouping="require_all" restart_on="error" type="service"> <service_fmri value="svc:/system/filesystem/local"/> </dependency> <method_context> <method_credential user="consul" group="consul"/> </method_context> <exec_method type="method" name="start" exec="/usr/local/bin/consul agent -config-dir %{config_dir}" timeout_seconds="60"/> <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/> <exec_method type="method" name="refresh" exec=":kill -HUP" timeout_seconds="10"/> <property_group name="startd" type="framework"> <propval name="duration" type="astring" value="child"/> <propval name="ignore_error" type="astring" value="core,signal"/> </property_group> <property_group name="application" type="application"> <propval name="config_dir" type="astring" value="/etc/consul.
Ansible modules for SmartOS imgadm and vmadm
As mentioned in an earlier post I’d been working on two new Ansible modules; for imgadm(1M) and vmadm(1M). So here I want to demonstrate these new modules which will be part of Ansible 2.3. imgadm The imgadm module allow for managing both images and data sources. Let’s start by adding a new data source:
- name: Add datasets.at source imgadm: source: ‘http://datasets.at/' state: present And we can remove it just as easily:
Running Ansible in the SmartOS global zone
None of the machines I currently run SmartOS on are big enough to run SDC/Triton, so I looked at Rundeck for creating zone definitions. and provisioning new zones as jobs. However Rundeck is unable to dynamically add new option fields. This is required for example in order to manage fields with an arbitrary number of keys, such as the network interfaces or disks.
In the meantime I’ve wanted to be able to run Ansible on my SmartOS nodes for a while now.
Setting up a SmartOS image server
Recently I’ve found myself in need of having a local SmartOS image server; while Joyent has a datacenter in Amsterdam, it seems that images are still pulled from the US west coast. After trying various servers and even the plain nginx setup (though that doesn’t appear to work anymore with imgadm v3), I finally ran into dsapid. After a bit of research it turns out there’s bits and pieces of documentation scattered across the web, so here’s one page which tries to bring it all together.
Docker on SmartOS, the harder way
SmartOS supports running Docker containers through Triton (SmartDataCenter). However I don’t have an entire datacenter at my disposal and the recommended specs for Triton are a bit more than the hardware I have available. I just want to run Docker containers on a single machine.
A little bit of background: SmartOS supports running native Linux binaries in LX-branded zones through their Linux emulation. This is the base for regular LX-branded zones (behaves like a normal Solaris zone) and thus also allows for pulling images from the Docker Hub and running them unmodified.
Populating resolv.conf with DCHP on SmartOS zones
Recently I started to experiment with SmartOS a bit more than my initial ooh, I a working zone…it’s nice weather today. So far I cannot help but feel that SmartOS feels Just Right.
At one point I needed to spin up a bunch of OS zones where I didn’t care about their IP addresses, thus setting their ip to dhcp. All went well and they got addresses and everything worked, except for DNS.