Using Gist As Your Blog
Github’s Gist is almost good enough as a blog. If you don’t want to take the time to set up your own blog, you could probably get away with using gists. As an example, this is a pretty decent index display.
Where it shines
nice comment system (example)
markdown support
auto-abstracts (shortened posts in index)
built-in editor or use git
store associated files with your article in a real git repo
nothing to host yourself
Where it falls short
no global feed
people don’t expect it to serve as your blog
gets cluttered with other snippets
google will not index these well
no analytics
it seems unlikely that someone will like your post and decide to go explore your other gists
Docker as a Full CentOS
Docker has arrived. It’s a "container" system for isolating services. It’s simpler and lighter than a VM, yet easier to use than a jail. But it’s not quite a full OS: it usually lacks things like systemd, cron, sshd, syslog, etc. Some folks are trying to address this for Ubuntu. It turns out that this can also be done with CentOS 7! This all-in-one docker instance becomes a great vehicle for testing deploys (and probably much more).
Ubuntu wasn’t going to work for my needs, but I found a minimal CentOS 7 version of the Ubuntu approach. So now Docker can actually be used for testing deployments with almost real full OSs.
Docker With CentOS 7
On your local host, stop docker if running (to reset IPs) and start up the docker service:
systemctl stop docker.service systemctl start docker.service
Maci has provided an article and repo to get centos7 working with docker, which this article extends.
Get it (one time ever):
git clone https://github.com/maci0/docker-systemd-unpriv cd docker-systemd-unpriv
Build (one time ever):
alias dk=docker # put in ~/.zshrc dk build --rm -t maci/systemd .
Fire up an instance any time, setting hostname etc:
dk run -h dk1 --rm -t -i -p 2221:22 -v /sys/fs/cgroup:/sys/fs/cgroup:ro maci/systemd /usr/lib/systemd/systemd
Switch to other term.
See the IP:
dk ps dk inspect 097241cd8024 |grep IPAddress
Test login:
sshpass -p root ssh dk1 # Oops. Wipe existing/offending key. sed -i '47d' ~/.ssh/known_hosts sshpass -p root ssh dk1
Manually update the system:
yum update
Optionally save as latest/greatest (see also):
dk commit c0d3c28f5a86 mde/centos71
Manually install the very basics, and set up a deploy user, say “dummy”:
# yum -y install openssh-clients sudo; useradd -m -G wheel dummy; passwd dummy
Get dummy into a good state:
# su - dummy % ssh somewhere-valid > yes # then ^c, just wanted proper .ssh/ dir created
Set up to watch progress in a logged in shell:
% sudo journalctl -xaf
Copy your ssh key onto it:
scp ~/.ssh/id_rsa.pub dk1:~/.ssh/authorized_keys
Run ansible toward it:
time ansible-playbook --skip=skip,security,nondocker -u dummy -b --ask-become-pass -l offsvrs:172.17.0.1 site.yml -v ; beep
When you’re done testing, shut down instance:
dk ps ... dk stop ea970de7e735
Save the image:
dk save -o centos7-systemd-maci.img.tar maci/systemd:latest gzip centos7-systemd-maci.img.tar
Archive it to S3:
s3.sh put centos7-systemd-maci.img.tar.gz s3://dockers.example.com
From Markdown to Asciidoc
UPDATE 2017: I’m going to move everything to org-mode or Markdown since I’m no longer finding the case for adoc compelling enough.
Markdown has become the de facto standard for plain text syntax. It’s supported in the webform editors of Stack Overflow, Github, and many blogs, wikis, and forums. It’s built into most static site generators. You can even use it to write a book. It’s fantastic that it has raised awareness of text-based markup, but it’s not enough.
Asciidoc fills in many of the shortcomings of Markdown. Here’s a cheat-sheet to give you a feel for its syntax. It’s almost as simple as Markdown, and thus quick to learn.
Cryogen Blog Setup
The tech running this blog is described on the About page. This recipe explains what I did to set it all up.
Infrastructure
You can set up a static site easily enough with Github pages, but I think it’s nice to manage a server yourself. You might want it for other things, and you get to control it completely. Your learnings there will apply to any other site/server you host.
You can get yourself a “Droplet” at DigitalOcean for $5 USD per month. That’s cheap. It’s just a matter of a few clicks on their simple control panel. I’m somewhat near San Francisco, so I chose that data center. I like CentOS quite a bit as a server OS, but I also like to play around with FreeBSD, so I chose that. It’s a recent addition to the DO arsenal, and is a rock-solid OS with a fantastic security record and a very famous file system: ZFS.
Deployment
I’ve configured Ansible to push changes to the Droplet. Take a look at the simple playbook. I’d normally have set this up hierarchically with roles, but this machine’s config is simple enough to fit in a single file.
Any time I feel like deploying, I can simple run deploy.zsh
to fire the
ansible-playbook
command.
Should I Run Today?
Probably…
It’s not downpouring or freezing or broiling.
My phone is charged and GPS is toiling.