This is a work in progress. I update this as I learn things.
Things To Know
Configuration file used by coreOS to configure itself. Processed on every system boot. Unit files define your units. drop-ins can be inside unit files. Think of drop-ins as, “drop in replacement” for a key/value that is already defined in a service. drop-ins override already defined settings.
Find overridden configuration files
A key/value store that is distributed among all machines in your cluster. Peers and clients connect to etcd. Peers are other servers in your cluster. Clients are tools like etcdctl which make changes to the key/value store. Depending on version, listens on TCP port [2379|4001] for etcd clients, and [2380|7001] for peers.
Depending on what platform you’re using (AWS, DigitalOcean, bare metal, etc.), as well as the version of coreOS you are running, you may or may not have an /etc/environment file. This file contains two environment variables which help your docker containers get the private IP address of their host. This file is important for etcd because without the containers knowing the private IP of their host, there’s no way for your containers to write to etcd. There’s been some developer conversation on whether this file is even going to be included by default in coreOS. In either case, if you don’t have one on your coreOS, there are methods here of generating one yourself (https://github.com/coreos/bugs/issues/65)
Show the coreOS version you’re running
Show status of all units
Show failed units
Show units of a certain type (failed, active, waiting, etc.)
reload etcd configuration
Use this when you changed a unit file on disk. example, you updated /etc/systemd/system/teamspeak3.service
see status of etcd
systemctl status etcd
To see all local configuration:
To see all runtime configuration:
To see all system unit configuration changes:
To see all runtime “drop-in” changes for system units:
systemd-delta –type=extended /run/systemd/system
How To Install New Software
Every piece of software is run in a docker container.
Create a unit file like this, with the name, [SERVICENAME].service (full docs)
[Unit] Description=Lightweight HTTP server Requires=docker.service [Service] ExecStartPre=-/usr/bin/docker kill HTTPD ExecStartPre=-/usr/bin/docker rm HTTPD ExecStartPre=/usr/bin/docker pull jprjr/lighttpd ExecStart=/usr/bin/docker run --name HTTPD -p 8080:8080/tcp -v /srv/httpd jprjr/lighttpd ExecStartPost=/usr/bin/etcdctl set /services/httpd/%H:8080 running ExecStop=/usr/bin/docker stop HTTPD ExecStopPost=/usr/bin/etcdctl rm /services/httpd/%H:8080 [Install] WantedBy=multi-user.target
Copy the file to the systemd unit file directory
# cp ~/lighttpd.service /etc/systemd/system/
Enable the unit file
# systemctl enable lighttpd.service Created symlink from /etc/systemd/system/multi-user.target.wants/lighttpd.service to /etc/systemd/system/lighttpd.service.
Start the unit
# systemctl start lighttpd.service
Follow the unit’s progress
$ journalctl -u lighttpd.service -f -- Logs begin at Tue 2015-02-24 16:31:53 UTC. -- Feb 26 12:53:16 localhost docker: bf54d7bd6d7b: Pulling metadata Feb 26 12:53:16 localhost docker: bf54d7bd6d7b: Pulling fs layer Feb 26 12:53:17 localhost docker: bf54d7bd6d7b: Download complete Feb 26 12:53:17 localhost docker: a157ebe8fcc8: Pulling metadata Feb 26 12:53:18 localhost docker: a157ebe8fcc8: Pulling fs layer Feb 26 12:53:19 localhost docker: a157ebe8fcc8: Download complete Feb 26 12:53:19 localhost docker: a157ebe8fcc8: Download complete Feb 26 12:53:19 localhost docker: Status: Downloaded newer image for jprjr/lighttpd:latest Feb 26 12:53:19 localhost etcdctl: running Feb 26 12:53:19 localhost systemd: Started Http server.
Open a terminal in a running docker container
In this example, we connect to the teamspeak3 (TS3) container we created previously.
docker exec -i -t TS3 /bin/bash
Now we are free to browse around the container, check logs, change things, etc.