6 ms·
Everyone interested in web dev should own a VPS. After a year working at a Rails shop that deploys to Heroku, I decided it's time to learn some sysadmin basics
by danneu 13y ago
Everyone interested in web dev should own a VPS.
After a year working at a Rails shop that deploys to Heroku, I decided it's time to learn some sysadmin basics. Here are some things I've done the past couple months that might give other noobs some ideas.
- Make aliases for most Linux commands. Abstract Linux into a simple interface of aliases that you can browse in your .zshrc/.bashrc/fish.config. Linux becomes much more enjoyable when you can type `untar <file>` instead of remembering the magical incantation `sudo tar -xzvf <file>`. Make aliases for everything. nginx-reload. nginx-restart. alias z="vim ~/.zshrc && source ~/.zshrc". I even abstract apt-get commands into ag-install, ag-update, ag-remote, etc.
- Use dropbox cli, a shared folder with dotfiles, and symlinks to keep dotfiles synced between your server(s) and laptop(s).
- Install tmux on it so that you can `$ tmux attach` to a persistent shell so that things still run when you close your remote connection and they're still there when you log back in.
- Run weechat (terminal irc client) in tmux so that you never have to log out of irc again.
- Learn how to rsync up and down files from your server.
- rsync your Sinatra app (or whatever) onto your server and run it on port 5000, immediately see it live.
- Install nginx and have your VPS serve multiple domain names, each domain name pointing to a Sinatra app running on port 5000, 5001, and 5002.
- Run each website in its own tmux tab. At the beginning it's easier to reason about a foreground process than some daemonized process.
- Install postgres or whatever database you use to your VPS. Get your db-driven app to connect to it. Connect to your remote db using your favorite db gui.
- Take notes of all the commands you use to set up each component so that you can refer to them later, see how you might have messed up.
- Learn enough bash/zsh/fish to automate all of those commands. Polish it enough so that you can curl your script from a Github gist on a fresh VPS and it will set up your entire environment.
- Install `htop` as a nice overview of your server's stats and the processes that are running. Run it in another tmux tab. My tmux right now has a tab for weechat (irc), tabs for my Clojure apps, and an htop tab. On Friday nights I pretend I'm NASA mission control.
- Learn how to use the `ssh` command to reverse tunnel a connection from your VPS to an app you're running on your local machine for a fast development feedback loop.
- Learn how to use your VPS to encrypt your connection when you're working at coffee shops.
I'm still a noob but I leveled up considerably from this quest arc. I highly recommend.
I still don't have a raging clue about most of Linux, even stuff like what all the folders are supposed to be for: /var/opt /etc/www /usr/local /usr/shared/local ... etc. and why files go the places they go, but it's all an iterative process.
Email me (profile) if you need help with any of the bullet points. I am trying to shape it into a more helpful blog post to share with other noobs.
- jschulenklopper 13y agoComplimens on all the achievements! Instead of renting a VPS, you could also purchase a Raspberry Pi for about $35, and get the same learning experience. In addition to that, the visibility of the cute blinking LEDs (in a transparent case) gives an opportunity for actual "RELAXEN UND WATSCHEN DER BLINKENLICHTEN" and the joy of actually owning "EIN KOMPUTERMASCHINE FÜR DER GEFINGERPOKEN UND MITTENGRABEN". Edit: the all caps is only because they are quoted verbatim from a famous blackletter sign in university computer rooms in mangled mock German.
- cma 13y ago>- Make aliases for most Linux commands. Abstract Linux into a simple interface of aliases that you can browse in your .zshrc/.bashrc/fish.config. Linux becomes much more enjoyable when you can type `untar <file>` instead of remembering the magical incantation `sudo tar -xzvf <file>`. Make aliases for everything. nginx-reload. nginx-restart. alias z="vim ~/.zshrc && source ~/.zshrc". I even abstract apt-get commands into ag-install, ag-update, ag-remote, etc. One problem with this is you become a cripple when you have to use an outside machine or need to write a script for wide distribution.
- scott_karana 13y agoAgreed. Aliases are good if used as a learning aid, but eventually you need to wean yourself off them if you're serious about sysadmin/devops.