or
and
- systemd, docker, (-compose), (-swarm), kubernetes, cloud services …
All of these things can make sense. But not necessarily for all the many, many people doing them out of hype-following (or fear of being left behind)!
https://www.infoq.com/presentations/Simple-Made-Easy
(Simple not only <> easy, also <> less work per se! Mario’s 0deps app: 5581c. Reimplemented w/ Spring Boot: 1740c. But: ~ 16.99 / 17 MiB smaller!)
Download image @ official download archives
Allows both Internet connection and host connection, unlike bridged no dep on host connectivity (also better protected).
passwd # set root password - make this good, won't need it much
dhclient em1 # get an IP address
# install runtime environment:
pkg install -g sudo rsync lsof screen runit \
openjdk8\* nginx-lite-1.10\* \
postgresql96-client\* postgresql96-contrib\* \
postgresql96-plpython\* postgresql96-server\*
adduser # create user for a human managing the box
visudo # give that user root privileges, just NOPASSWD: ALL it
# persistently enable some things
cat >> /etc/rc.conf <<EOF
sshd_enable="YES"
ifconfig_em0="DHCP"
ifconfig_em1="DHCP"
runsvdir_enable="YES"
runsvdir_path="/service"
EOF
# OpenJDK needs fdescfs & proc
cat >> /etc/fstab << EOF
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0
EOF
7 commands! (not the shortest, but just count ’em!) – I also put them in the repo. :)
rsync --rsync-path "mkdir -p .ssh && rsync" .ssh/id_rsa.pub \
username@vm:.ssh/authorized_keys
- Boot, then
mkdir /blah && mount -t cd9660 /dev/cd0r /blah
postgres/run
:
#!/bin/sh
exec chpst -u postgres -U postgres '/usr/local/bin/postgres' -D "$DATA_DIR"
postgres/log/run
:
#!/bin/sh
exec '/usr/local/bin/svlogd' -t .
- Often useful pattern: one dir with all the service scripts …
- … and one (the one that’s actually supervised) with links to the active ones.
runsvdir /active-services-directory ......
-
$n$ dots at the end will be used to show last$n$ characters of services’ stderrors - don’t send secrets there - visible in
ps(1)
output! - that’s right - runsvdir writes urgent maintenance messages right into
argv
:D
env -i RC_CONF=/path/to/rc.config BASE_DIR=/path/to/basedir runsvdir /service …
redis_ip=10.0.5.3
postgres_host=127.0.0.1
postgres_db=bla_private
#!/bin/sh
. "$RC_CONF"
exec chpst -u blauser java -jar /…/bla.jar --spring.redis.host="$redis_ip" \
--spring.datasource.url="jdbc:postgresql://$postgres_host/$postgres_db"
- also allows multiple envs - just have multiple rc files & services dirs
- but this is really fast, native and resource-sparing
Shell 1:
./gradlew bootRun --debug-jvm
Shell 2:
postgres -D data-dir
[MAYBE!] Shell 3:
devd -w project/statics-dir http://localhost:8080
✅
- creating service users
- isolating permissions
- assigning ports
- modifying (some) service scripts
- managing storage
- …
- All I can say is: I can recommend a great freelance sysadmin
- Don’t let devops hype trick you into believing you can ops just ’cause you can dev
The people who build operating systems didn’t just sit around awaiting what 2013 might bring – there’s lots of great stuff, if one’s willing to look around!
lots of great stuff means reading lots of man pages
I’m Bernd Haug <[email protected]>
I’ve been doing ops and development for ~20y.
Working at xaidat.com, trying to make things simpler for customers
(and sometimes easier)