class: center, middle # Welcome to DevOps State College --- # Why DevOps State College? * Build a community and make connections * Exchange ideas * Learn * Promote DevOps culture * Fun * Not tied to one vendor/technology --- # What is DevOps? Grand unification of philosophy around how to manage Development (programmers, application analysts, application owners, project managers) and IT Operations (system admins, network admins, security, data center, storage, database admin) in a tightly-integrated way. DevOps is the belief that working together as a collaborative team will produce better results, and break down barriers and finger pointing. --- # Future Presentations --- # Job Opportunities * AppliedTrust * AppliedTrust is hiring in Philadelphia, Dallas and Boulder offices. * For more information, see https://www.appliedtrust.com/jobs/ or talk to me afterwards --- # Intro to systemd * Commands * systemctl * systemd-cgls * systemd-analyze * journalctl --- # Overview of all services * systemctl * show loaded active units * systemd-cgls * Recursively show control group contents * systemctl status * shows all system statuses for active units * systemctl list-unit-files * shows all unit files --- # Service Info * systemctl status apache2.service apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2) Active: active (running) since Wed 2016-03-09 12:13:04 EST; 1 day 4h ago Process: 784 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS) CGroup: /system.slice/apache2.service ├─1012 /usr/sbin/apache2 -k start ├─1017 /usr/sbin/apache2 -k start ├─1023 /usr/sbin/apache2 -k start └─1024 /usr/sbin/apache2 -k start * flags * -l: shows full lines. by default, elipsizes long lines * -n: shows N lines of log * works for other unit files to (socket, timer, etc...) --- # Reading the journal * journalctl * journalctl * shows all logs * journalctl _SYSTEMD_UNIT=apache2.service * shows logs from unit file --- # Managing Services * systemctl start * Starts a service. If no systemd unit file exists, will run /etc/init.d/service start * systemctl stop * Stops a service. If no systemd unit file exists, will run /etc/init.d/service stop * systemctl restart * Restarts a service. If no systemd unit file exists, will run /etc/init.d/service restart * systemctl reload * Reloads configuration for a service. In case of apache, would be httpd.conf --- # Analyzing System bootup * systemd-analyze Startup finished in 3.982s (kernel) + 14.781s (userspace) = 18.764s * systemd-analyze blame ``` 6.323s wysevpn.service 4.030s networking.service 2.472s exim4.service 1.344s apache2.service ``` --- # Writing service unit files [Unit] Description=recipe application After=network.target [Service] PIDFile=/tmp/recipe.pid User=ansible Group=ansible WorkingDirectory=/opt/recipe ExecStart=/opt/recipe/python/bin/gunicorn -b 0.0.0.0:8080 --pid /tmp/recipe.pid recipe:app ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target * systemctl daemon-reload * reloads service unit files from disk --- # Logging * Journal collects logging from 3 sources: 1. All data logged via libc syslog() 2. The data from the kernel logged with printk() 3. Everything written to STDOUT/STDERR of any system service --- # Socket Activation * Listening sockets are created *before* the daemon is started * Dependencies don't matter * Services can be terminated and replaced without the client even knowing * Software needs to support it * For an example of how this is done in practice, see: http://0pointer.de/blog/projects/socket-activation2.html --- # Learn More * Systemd for administrators blog series * https://gist.github.com/bcremer/8cdf6900c35dda65f387 * Systemd for developers blog series * http://0pointer.de/blog/projects/socket-activation.html * http://0pointer.de/blog/projects/socket-activation2.html * http://0pointer.de/blog/projects/journal-submit.html * Official systemd page * https://www.freedesktop.org/wiki/Software/systemd/ --- class: center, middle # Live Demo