From f4fcb0c54c8d497d112e2159dad7909c3c689095 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Sat, 2 May 2020 16:14:11 +0300 Subject: [PATCH] docs(docs-infra): update preview server setup instructions (#36837) I recently went through the process of setting up a preview server VM again and updated the instructions and references based on the latest docs for Debian, Docker, Google Compute Engine, etc. PR Close #36837 --- .../docs/vm-setup--attach-persistent-disk.md | 6 ++--- .../docs/vm-setup--create-docker-image.md | 12 ++++++---- .../docs/vm-setup--set-up-docker.md | 23 +++++++------------ .../docs/vm-setup--update-docker-container.md | 8 +++---- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/aio/aio-builds-setup/docs/vm-setup--attach-persistent-disk.md b/aio/aio-builds-setup/docs/vm-setup--attach-persistent-disk.md index 21c24bdb75..256239d2f7 100644 --- a/aio/aio-builds-setup/docs/vm-setup--attach-persistent-disk.md +++ b/aio/aio-builds-setup/docs/vm-setup--attach-persistent-disk.md @@ -3,7 +3,7 @@ ## Create `aio-builds` persistent disk (if not already exists) - Follow instructions [here](https://cloud.google.com/compute/docs/disks/add-persistent-disk#create_disk). -- `sudo mkfs.ext4 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/disk/by-id/google-aio-builds` +- `sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/disk/by-id/google-aio-builds` ## Mount disk @@ -14,7 +14,7 @@ ## Mount disk on boot - Run: - ``` + ```sh echo UUID=`sudo blkid -s UUID -o value /dev/disk/by-id/google-aio-builds` \ - /mnt/disks/aio-builds ext4 discard,defaults,nofail 0 2 | sudo tee -a /etc/fstab + /mnt/disks/aio-builds ext4 defaults,discard,nofail 0 2 | sudo tee -a /etc/fstab ``` diff --git a/aio/aio-builds-setup/docs/vm-setup--create-docker-image.md b/aio/aio-builds-setup/docs/vm-setup--create-docker-image.md index f46a953d04..935a77c27f 100644 --- a/aio/aio-builds-setup/docs/vm-setup--create-docker-image.md +++ b/aio/aio-builds-setup/docs/vm-setup--create-docker-image.md @@ -1,10 +1,12 @@ # VM setup - Create docker image -## Install node and yarn -- Install [nvm](https://github.com/creationix/nvm#installation). -- Install node.js: `nvm install 8` -- Install yarn: `npm -g install yarn` +## Install git, Node.js and yarn +- `sudo apt-get update` +- `sudo apt-get install -y git` +- Install [nvm](https://github.com/nvm-sh/nvm#installing-and-updating). +- Install Node.js: `nvm install 12` +- Install yarn: `npm install --global yarn` ## Checkout repository @@ -26,7 +28,7 @@ The following commands would create a docker image from GitHub repo `foo/bar` to - `git clone https://github.com/foo/bar.git foobar` - Run: - ``` + ```sh ./foobar/aio-builds-setup/scripts/create-image.sh foobar-builds \ --build-arg AIO_REPO_SLUG=foo/bar \ --build-arg AIO_DOMAIN_NAME=foobar-builds.io \ diff --git a/aio/aio-builds-setup/docs/vm-setup--set-up-docker.md b/aio/aio-builds-setup/docs/vm-setup--set-up-docker.md index 9789380243..3156f6290a 100644 --- a/aio/aio-builds-setup/docs/vm-setup--set-up-docker.md +++ b/aio/aio-builds-setup/docs/vm-setup--set-up-docker.md @@ -3,24 +3,17 @@ ## Install docker -_Debian (jessie):_ -- `sudo apt-get update` -- `sudo apt-get install -y apt-transport-https ca-certificates curl git software-properties-common` -- `curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -` -- `apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D` -- `sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ debian-$(lsb_release -cs) main"` -- `sudo apt-get update` -- `sudo apt-get -y install docker-engine` +Official installation instructions: https://docs.docker.com/engine/install +Example: -_Ubuntu (16.04):_ +_Debian (buster):_ - `sudo apt-get update` -- `sudo apt-get install -y curl git linux-image-extra-$(uname -r) linux-image-extra-virtual` -- `sudo apt-get install -y apt-transport-https ca-certificates` -- `curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -` -- `apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D` -- `sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main"` +- `sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common` +- `curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -` +- `sudo apt-key fingerprint 0EBFCD88` +- `sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"` - `sudo apt-get update` -- `sudo apt-get -y install docker-engine` +- `sudo apt-get -y install docker-ce docker-ce-cli containerd.io` ## Start the docker diff --git a/aio/aio-builds-setup/docs/vm-setup--update-docker-container.md b/aio/aio-builds-setup/docs/vm-setup--update-docker-container.md index 719ff0903f..9b181b6b07 100644 --- a/aio/aio-builds-setup/docs/vm-setup--update-docker-container.md +++ b/aio/aio-builds-setup/docs/vm-setup--update-docker-container.md @@ -31,7 +31,7 @@ used for. ## Run the script manually You may choose to manually run the script, when necessary. Example: -``` +```sh update-preview-server.sh \ /path/to/repo \ /path/to/localcerts \ @@ -43,10 +43,10 @@ update-preview-server.sh \ ## Run the script automatically You may choose to automatically trigger the script, e.g. using a cronjob. For example, the following -cronjob entry would run the script every hour and update the preview server (assuming the user has -the necessary permissions): +cronjob entry would run the script every 30 minutes, update the preview server (if necessary) and +log its output to `update-preview-server.log` (assuming the user has the necessary permissions): ``` # Periodically check for changes and update the preview server (if necessary) -*/30 * * * * /path/to/update-preview-server.sh /path/to/repo /path/to/localcerts /path/to/secrets /path/to/builds /path/to/logs +*/30 * * * * /path/to/update-preview-server.sh /path/to/repo /path/to/localcerts /path/to/secrets /path/to/builds /path/to/logs >> /path/to/update-preview-server.log 2>&1 ```