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
This commit is contained in:
George Kalpakas 2020-05-02 16:14:11 +03:00 committed by Alex Rickabaugh
parent e92b81351b
commit f4fcb0c54c
4 changed files with 22 additions and 27 deletions

View File

@ -3,7 +3,7 @@
## Create `aio-builds` persistent disk (if not already exists) ## Create `aio-builds` persistent disk (if not already exists)
- Follow instructions [here](https://cloud.google.com/compute/docs/disks/add-persistent-disk#create_disk). - 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 ## Mount disk
@ -14,7 +14,7 @@
## Mount disk on boot ## Mount disk on boot
- Run: - Run:
``` ```sh
echo UUID=`sudo blkid -s UUID -o value /dev/disk/by-id/google-aio-builds` \ 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
``` ```

View File

@ -1,10 +1,12 @@
# VM setup - Create docker image # VM setup - Create docker image
## Install node and yarn ## Install git, Node.js and yarn
- Install [nvm](https://github.com/creationix/nvm#installation). - `sudo apt-get update`
- Install node.js: `nvm install 8` - `sudo apt-get install -y git`
- Install yarn: `npm -g install yarn` - 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 ## 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` - `git clone https://github.com/foo/bar.git foobar`
- Run: - Run:
``` ```sh
./foobar/aio-builds-setup/scripts/create-image.sh foobar-builds \ ./foobar/aio-builds-setup/scripts/create-image.sh foobar-builds \
--build-arg AIO_REPO_SLUG=foo/bar \ --build-arg AIO_REPO_SLUG=foo/bar \
--build-arg AIO_DOMAIN_NAME=foobar-builds.io \ --build-arg AIO_DOMAIN_NAME=foobar-builds.io \

View File

@ -3,24 +3,17 @@
## Install docker ## Install docker
_Debian (jessie):_ Official installation instructions: https://docs.docker.com/engine/install
- `sudo apt-get update` Example:
- `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`
_Ubuntu (16.04):_ _Debian (buster):_
- `sudo apt-get update` - `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 gnupg-agent software-properties-common`
- `sudo apt-get install -y apt-transport-https ca-certificates` - `curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -`
- `curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -` - `sudo apt-key fingerprint 0EBFCD88`
- `apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D` - `sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"`
- `sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main"`
- `sudo apt-get update` - `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 ## Start the docker

View File

@ -31,7 +31,7 @@ used for.
## Run the script manually ## Run the script manually
You may choose to manually run the script, when necessary. Example: You may choose to manually run the script, when necessary. Example:
``` ```sh
update-preview-server.sh \ update-preview-server.sh \
/path/to/repo \ /path/to/repo \
/path/to/localcerts \ /path/to/localcerts \
@ -43,10 +43,10 @@ update-preview-server.sh \
## Run the script automatically ## Run the script automatically
You may choose to automatically trigger the script, e.g. using a cronjob. For example, the following 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 cronjob entry would run the script every 30 minutes, update the preview server (if necessary) and
the necessary permissions): 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) # 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
``` ```