I’m fairly new to rancher and trying to get a system service running on an aws instance. I’m using the latest recommended rancher ami (v0.5.0) and have added user-data to my launch configuration. If I understand correctly, this userdata should be added to boot.yml, but boot.yml is empty and I can’t figure out where my user-data is actually being used (if at all). Here’s the gist of the userdata available to the instance. What am I doing wrong here?
> wget -qO- http://169.254.169.254/latest/user-data
#cloud-config
rancher:
environment:
- MYSQL_USER=rancheros
- MYSQL_PASSWORD=rancheros
- MYSQL_DATABASE=rancheros
services:
mysql:
image: bdentino/mysql-asg
restart: always
net: host
labels:
- io.rancher.os.scope=system
- io.rancher.os.after=docker
environment:
- DATADIR=/data
- MYSQL*
Here’s the full config export:
rancher:
autoformat:
autoformat:
image: rancher/os-autoformat:v0.5.0
labels:
io.rancher.os.detach: "false"
io.rancher.os.scope: system
log_driver: json-file
net: none
privileged: true
udev-autoformat:
image: rancher/os-udev:v0.5.0
labels:
io.rancher.os.after: autoformat
io.rancher.os.detach: "false"
io.rancher.os.scope: system
log_driver: json-file
net: host
privileged: true
uts: host
volumes:
- /dev:/host/dev
- /lib/modules:/lib/modules
- /lib/firmware:/lib/firmware
bootstrap:
state-script:
image: rancher/os-statescript:v0.5.0
labels:
io.rancher.os.after: udev-bootstrap
io.rancher.os.detach: "false"
io.rancher.os.scope: system
log_driver: json-file
net: host
privileged: true
uts: host
volumes:
- /dev:/host/dev
- /lib/modules:/lib/modules
- /lib/firmware:/lib/firmware
- /usr/bin/ros:/usr/bin/ros:ro
- /usr/share/ros:/usr/share/ros:ro
udev-bootstrap:
environment:
- BOOTSTRAP=true
image: rancher/os-udev:v0.5.0
labels:
io.rancher.os.detach: "false"
io.rancher.os.scope: system
log_driver: json-file
net: host
privileged: true
uts: host
volumes:
- /dev:/host/dev
- /lib/modules:/lib/modules
- /lib/firmware:/lib/firmware
bootstrap_docker:
args:
- daemon
- -s
- overlay
- -b
- none
- --restart=false
- -g
- /var/lib/system-docker
- -G
- root
- -H
- unix:///var/run/system-docker.sock
- --userland-proxy=false
cloud_init:
datasources:
- ec2
console: default
defaults:
hostname: rancher
network:
dns:
nameservers:
- 8.8.8.8
- 8.8.4.4
docker:
args:
- daemon
- --log-opt
- max-size=25m
- --log-opt
- max-file=2
- -s
- overlay
- -G
- docker
- -H
- unix:///var/run/docker.sock
tls_args:
- --tlsverify
- --tlscacert=/etc/docker/tls/ca.pem
- --tlscert=/etc/docker/tls/server-cert.pem
- --tlskey=/etc/docker/tls/server-key.pem
- -H=0.0.0.0:2376
environment:
SUFFIX: null
VERSION: v0.5.0
repositories:
core:
url: https://raw.githubusercontent.com/rancher/os-services/v0.5.0
resize_device: /dev/xvda
services:
acpid:
command: /usr/sbin/acpid -f
image: rancher/os-base:v0.5.0
labels:
io.rancher.os.scope: system
net: host
privileged: true
uts: host
volumes_from:
- command-volumes
- system-volumes
all-volumes:
command: echo
image: rancher/os-base:v0.5.0
labels:
io.rancher.os.createonly: "true"
io.rancher.os.scope: system
log_driver: json-file
net: none
privileged: true
read_only: true
volumes_from:
- container-data-volumes
- command-volumes
- user-volumes
- system-volumes
cloud-init:
image: rancher/os-cloudinit:v0.5.0
labels:
io.rancher.os.after: ntp
io.rancher.os.detach: "false"
io.rancher.os.reloadconfig: "true"
io.rancher.os.scope: system
net: host
privileged: true
uts: host
volumes_from:
- command-volumes
- system-volumes
cloud-init-pre:
environment:
- CLOUD_INIT_NETWORK=false
image: rancher/os-cloudinit:v0.5.0
labels:
io.rancher.os.after: preload-system-images
io.rancher.os.detach: "false"
io.rancher.os.reloadconfig: "true"
io.rancher.os.scope: system
net: host
privileged: true
uts: host
volumes_from:
- command-volumes
- system-volumes
command-volumes:
command: echo
image: rancher/os-base:v0.5.0
labels:
io.rancher.os.createonly: "true"
io.rancher.os.scope: system
log_driver: json-file
net: none
privileged: true
read_only: true
volumes:
- /usr/bin/docker-containerd:/usr/bin/docker-containerd.dist:ro
- /usr/bin/docker-containerd-shim:/usr/bin/docker-containerd-shim.dist:ro
- /usr/bin/docker-runc:/usr/bin/docker-runc.dist:ro
- /usr/bin/docker:/usr/bin/docker.dist:ro
- /usr/bin/ros:/usr/bin/dockerlaunch:ro
- /usr/bin/ros:/usr/bin/user-docker:ro
- /usr/bin/ros:/usr/bin/system-docker:ro
- /usr/bin/ros:/sbin/poweroff:ro
- /usr/bin/ros:/sbin/reboot:ro
- /usr/bin/ros:/sbin/halt:ro
- /usr/bin/ros:/sbin/shutdown:ro
- /usr/bin/ros:/usr/bin/respawn:ro
- /usr/bin/ros:/usr/bin/ros:ro
- /usr/bin/ros:/usr/bin/cloud-init:ro
- /usr/bin/ros:/usr/sbin/netconf:ro
- /usr/bin/ros:/usr/sbin/wait-for-docker:ro
- /usr/bin/ros:/usr/bin/switch-console:ro
console:
image: rancher/os-console:v0.5.0
ipc: host
labels:
io.docker.compose.rebuild: always
io.rancher.os.after: network
io.rancher.os.console: default
io.rancher.os.scope: system
net: host
pid: host
privileged: true
restart: always
uts: host
volumes:
- /usr/bin/iptables:/sbin/iptables:ro
- /media:/media:shared
- /mnt:/mnt:shared
volumes_from:
- all-volumes
container-data-volumes:
command: echo
image: rancher/os-base:v0.5.0
labels:
io.rancher.os.createonly: "true"
io.rancher.os.scope: system
log_driver: json-file
net: none
privileged: true
read_only: true
volumes:
- /var/lib/docker:/var/lib/docker
docker:
command: /usr/bin/user-docker
environment:
- HTTP_PROXY
- HTTPS_PROXY
- NO_PROXY
image: rancher/os-base:v0.5.0
ipc: host
labels:
io.rancher.os.after: console
io.rancher.os.scope: system
net: host
pid: host
privileged: true
restart: always
uts: host
volumes:
- /sys/fs/cgroup:/host/sys/fs/cgroup
volumes_from:
- all-volumes
network:
command: netconf --stop-network-pre
image: rancher/os-base:v0.5.0
labels:
io.rancher.os.after: cloud-init
io.rancher.os.scope: system
net: host
pid: host
privileged: true
uts: host
volumes_from:
- command-volumes
- system-volumes
network-pre:
command: netconf
image: rancher/os-base:v0.5.0
labels:
io.rancher.os.after: cloud-init-pre
io.rancher.os.scope: system
net: host
pid: host
privileged: true
uts: host
volumes_from:
- command-volumes
- system-volumes
ntp:
command: ntpd --nofork -g
image: rancher/os-base:v0.5.0
labels:
io.rancher.os.after: network-pre
io.rancher.os.scope: system
net: host
privileged: true
restart: always
uts: host
preload-system-images:
image: rancher/os-preload:v0.5.0
labels:
io.rancher.os.detach: "false"
io.rancher.os.scope: system
net: host
privileged: true
volumes:
- /var/run/system-docker.sock:/var/run/docker.sock
- /var/lib/rancher/preload/system-docker:/mnt/preload
- /usr/bin/ros:/usr/sbin/wait-for-docker:ro
volumes_from:
- command-volumes
- system-volumes
preload-user-images:
image: rancher/os-preload:v0.5.0
labels:
io.rancher.os.after: console
io.rancher.os.detach: "false"
io.rancher.os.scope: system
net: host
privileged: true
volumes:
- /var/run/:/var/run/
- /var/lib/rancher/preload/docker:/mnt/preload
- /usr/bin/ros:/usr/sbin/wait-for-docker:ro
volumes_from:
- command-volumes
- system-volumes
syslog:
image: rancher/os-syslog:v0.5.0
labels:
io.rancher.os.scope: system
log_driver: json-file
net: host
privileged: true
restart: always
uts: host
volumes_from:
- system-volumes
system-volumes:
command: echo
image: rancher/os-base:v0.5.0
labels:
io.rancher.os.createonly: "true"
io.rancher.os.scope: system
log_driver: json-file
net: none
privileged: true
read_only: true
volumes:
- /dev:/host/dev
- /etc/docker:/etc/docker
- /etc/hosts:/etc/hosts
- /etc/resolv.conf:/etc/resolv.conf
- /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt.rancher
- /etc/selinux:/etc/selinux
- /lib/firmware:/lib/firmware
- /lib/modules:/lib/modules
- /run:/run
- /usr/share/ros:/usr/share/ros
- /var/lib/rancher/cache:/var/lib/rancher/cache
- /var/lib/rancher/conf:/var/lib/rancher/conf
- /var/lib/rancher:/var/lib/rancher
- /var/log:/var/log
- /var/run:/var/run
udev:
environment:
- DAEMON=true
image: rancher/os-udev:v0.5.0
labels:
io.rancher.os.detach: "true"
io.rancher.os.scope: system
net: host
privileged: true
restart: always
uts: host
volumes_from:
- system-volumes
udev-cold:
image: rancher/os-udev:v0.5.0
labels:
io.rancher.os.before: udev
io.rancher.os.scope: system
net: host
privileged: true
uts: host
volumes_from:
- system-volumes
user-volumes:
command: echo
image: rancher/os-base:v0.5.0
labels:
io.rancher.os.createonly: "true"
io.rancher.os.scope: system
log_driver: json-file
net: none
privileged: true
read_only: true
volumes:
- /home:/home
- /opt:/opt
state:
dev: LABEL=RANCHER_STATE
fstype: auto
oem_dev: LABEL=RANCHER_OEM
oem_fstype: auto
system_docker:
args:
- daemon
- --log-opt
- max-size=25m
- --log-opt
- max-file=2
- -s
- overlay
- --restart=false
- -g
- /var/lib/system-docker
- -G
- root
- -p
- /var/run/system-docker.pid
- --exec-root=/var/run/system-docker
- --config-file=/etc/docker/system-daemon.json
- -H
- unix:///var/run/system-docker.sock
- --userland-proxy=false
exec: true
upgrade:
image: rancher/os
url: https://releases.rancher.com/os/releases.yml
denise
August 3, 2016, 5:47am
4
Sorry for the delay.
A couple of things.
This section is invalid as rancher.environment
doesn’t support arrays.
#cloud-config
rancher:
environment:
- MYSQL_USER=rancheros
- MYSQL_PASSWORD=rancheros
- MYSQL_DATABASE=rancheros
I’ve filed a GH issue that we should support array.
opened 05:44AM - 03 Aug 16 UTC
kind/bug
priority/p2
**RancherOS Version: (ros os version)**
v0.5.0
**Where are you running RancherO… S? (docker-machine, AWS, GCE, baremetal, etc.)**
AWS
When trying this cloud-config, it failed as `rancher.environment` doesn't support arrays.
```
#cloud-config
rancher:
environment:
- MYSQL_USER=rancheros
- MYSQL_PASSWORD=rancheros
- MYSQL_DATABASE=rancheros
```
And I figured it out by using @joshwget ’s RancherOS cloud-config validator: http://curl.me/validator
Awesome, thanks for the validator tip!