From 060e54e814969b0c125234ea127443991c8af74c Mon Sep 17 00:00:00 2001 From: Vishnu KS Date: Sat, 2 May 2020 01:11:43 +0530 Subject: [PATCH] droplets: Add instruction to create a new base image. --- tools/droplets/README.md | 51 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/tools/droplets/README.md b/tools/droplets/README.md index c851a2f234..a513d1373a 100644 --- a/tools/droplets/README.md +++ b/tools/droplets/README.md @@ -122,7 +122,7 @@ so they are notified. Rough steps: -1. Get the `ssh` key for `base.zulipdev.org` from Christie or Rishi. +1. Get the `ssh` key for `base.zulipdev.org` from Tim, Vishnu or Rishi. 1. Power up the `base.zulipdev.org` droplet from the digitalocean UI. You probably have to be logged in in the Zulip organization view, rather than via your personal account. @@ -138,13 +138,54 @@ Rough steps: and shutdown the droplet. 1. Go to the Images tab on DigitalOcean, and "Take a Snapshot". 1. Wait for several minutes. -1. Make sure to add the appropriate regions via More -> "Add to region" in - the Snapshots section. 1. Do something like `curl -X GET -H "Content-Type: application/json" - -u : "https://api.digitalocean.com/v2/images?page=5" | grep --color=always base.zulipdev.org` + -u : "https://api.digitalocean.com/v2/images?page=11" | grep --color=always base.zulipdev.org` (maybe with a different page number, and replace your API_KEY). 1. Replace `template_id` in `create.py` in this directory with the - appropriate `id`, and region with the appropriate region. + appropriate `id`. +1. Test that everything works. +1. Open a PR with the updated template_id in zulip/zulip! + +## Creating a new base image +Creating a new base image happens rarely since updating the base image is good enough most of the time. +Check out https://chat.zulip.org/#narrow/stream/3-backend/topic/new.20base.20dev.20droplet to view the +discussion when we attempted to do upgrade last time. + +Rough steps: + +1. Get the `ssh` key for `base.zulipdev.org` from Tim, Vishnu or Rishi. +1. Log in to the Zulip organization view, rather than via your personal account. +1. Create a new droplet in Digital Ocean with 2GB RAM and `base.zulipdev.org` as the + SSH authentication key. +1. Login to the droplet as root user. Make sure to point the SSH program to the private + key of `base.zulipdev.org` during this step. +1. Create a user called `zulipdev` and add it to the `sudo` group. +1. Make sudo of `zulipdev` user passwordless by including + `zulipdev ALL=(ALL) NOPASSWD:ALL` in `/etc/sudoers.d/90-cloud-init-users` +1. Copy the `authorized_keys` file of `root` user to the `.ssh` directory of `zulipdev` user +1. Switch to `zulipdev` user and set the permissions for the `.ssh` folder to `700` and + `.ssh/authorized_keys` to `600`. +1. Clone `https://github.com/zulip/zulip` repository in the home directory of `zulipdev`. +1. `git remote rename origin upstream` +1. `git clean -f`, in case things were added/removed from `.gitignore`. +1. `tools/provision` +1. Insert `NODENAME=zulip@localhost` to `/etc/rabbitmq/rabbitmq-env.conf` +1. `tools/provision` +1. `tools/run-dev.py`, and check that `base.zulipdev.org:9991` is up and running. +1. Clone `https://github.com/zulip/python-zulip-api` repository in the home directory of `zulipdev`. +1. `git remote rename origin upstream` +1. `git clean -f`, in case things were added/removed from `.gitignore`. +1. `./tools/provision`. +1. `> ~/.bash_history && history -c && exit` +1. SSH to root user. +1. `> ~/.bash_history && history -c && sudo shutdown -h now` +1. Go to the Images tab on DigitalOcean, and "Take a Snapshot". +1. Wait for several minutes. +1. Do something like `curl -X GET -H "Content-Type: application/json" + -u : "https://api.digitalocean.com/v2/images?page=11" | grep --color=always base.zulipdev.org` + (maybe with a different page number, and replace your API_KEY). +1. Replace `template_id` in `create.py` in this directory with the + appropriate `id`. 1. Test that everything works. 1. Open a PR with the updated template_id in zulip/zulip!