From 0bd19aadb9a9bc4e915a268a3d2b9dc2075bac75 Mon Sep 17 00:00:00 2001 From: Gianpaolo Macario Date: Sun, 18 Jul 2021 14:17:19 +0200 Subject: [PATCH 1/9] Create submit-blobfishes-to-do-hackathon.md --- docs/submit-blobfishes-to-do-hackathon.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/submit-blobfishes-to-do-hackathon.md diff --git a/docs/submit-blobfishes-to-do-hackathon.md b/docs/submit-blobfishes-to-do-hackathon.md new file mode 100644 index 0000000..5e3a6c7 --- /dev/null +++ b/docs/submit-blobfishes-to-do-hackathon.md @@ -0,0 +1,5 @@ +# Submit Blobfishes project entry to DigitalOcean MongoDB hackathon + +TODO + + From 9f10785c469567c692b1a5b4196b5bf7fe59b24a Mon Sep 17 00:00:00 2001 From: Gianpaolo Macario Date: Sun, 18 Jul 2021 15:47:14 +0200 Subject: [PATCH 2/9] .settings.json: Add css.validate: false Avoid messing up with CSS layout Signed-off-by: Gianpaolo Macario --- .vscode/settings.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b6d7807 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "css.validate": false +} From 8d7b60fb317b854f0059012b05494cc7ffe679a4 Mon Sep 17 00:00:00 2001 From: Gianpaolo Macario Date: Sun, 18 Jul 2021 15:57:22 +0200 Subject: [PATCH 3/9] Starting filling in submission form Signed-off-by: Gianpaolo Macario --- docs/submit-blobfishes-to-do-hackathon.md | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/submit-blobfishes-to-do-hackathon.md b/docs/submit-blobfishes-to-do-hackathon.md index 5e3a6c7..df230ed 100644 --- a/docs/submit-blobfishes-to-do-hackathon.md +++ b/docs/submit-blobfishes-to-do-hackathon.md @@ -1,5 +1,35 @@ # Submit Blobfishes project entry to DigitalOcean MongoDB hackathon +Fill in in the ["DigitalOcean MongoDB Hackathon Submission" form](https://docs.google.com/forms/d/e/1FAIpQLSewoy9wPZ892wg1cf87eeEgL5XmbvGZ4csrULegIoL0w5tJ_A/viewform?usp=sf_link): + +TODO + +(2021-07-xx xx:xx CEST) + +> **DigitalOcean MongoDB Hackathon Submission** +> +> Submit the awesome app you built and get a shirt and sticker pack! +> +> \* Required +> +> * Email * +> - `gmacario@gmail.com` +> * What I built for this hackathon * +> - `Blobfishes - The ugliest project participating to the DigitalOcean MongoDB Hackathon` +> * Link to my live app * +> - Deploy your app to DigitalOcean and add the link here: +> - `TODO` +> * Link to my GitHub repo * +> - Make sure the repo is public and the license is MIT, Apache, BSD-2, BSD-3, +> or Commons Clause. +> - `TODO` +> * Articles I wrote about my app +> - Add a link on a new line +> - `https://gmacario.github.io/posts/2021-07-17-our-journey-to-do-mongodb-hackathon` +> - `https://gmacario.github.io/posts/2021-07-20-blobfishes-submitted-to-mongodb-hackathon` + +Click "Next". + TODO From 34408bf08b6acf1324d71d68565dcf8a971ddebc Mon Sep 17 00:00:00 2001 From: Gianpaolo Macario Date: Sun, 18 Jul 2021 16:07:15 +0200 Subject: [PATCH 4/9] Continue filling in the submission form Signed-off-by: Gianpaolo Macario --- docs/submit-blobfishes-to-do-hackathon.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/submit-blobfishes-to-do-hackathon.md b/docs/submit-blobfishes-to-do-hackathon.md index df230ed..8293889 100644 --- a/docs/submit-blobfishes-to-do-hackathon.md +++ b/docs/submit-blobfishes-to-do-hackathon.md @@ -8,23 +8,21 @@ TODO > **DigitalOcean MongoDB Hackathon Submission** > -> Submit the awesome app you built and get a shirt and sticker pack! -> +> Submit the awesome app you built and get a shirt and sticker pack!
> \* Required > > * Email * > - `gmacario@gmail.com` > * What I built for this hackathon * > - `Blobfishes - The ugliest project participating to the DigitalOcean MongoDB Hackathon` -> * Link to my live app * -> - Deploy your app to DigitalOcean and add the link here: -> - `TODO` -> * Link to my GitHub repo * -> - Make sure the repo is public and the license is MIT, Apache, BSD-2, BSD-3, -> or Commons Clause. +> * Link to my live app *
+> Deploy your app to DigitalOcean and add the link here: > - `TODO` -> * Articles I wrote about my app -> - Add a link on a new line +> * Link to my GitHub repo *
+> Make sure the repo is public and the license is MIT, Apache, BSD-2, BSD-3, or Commons Clause. +> - `https://github.com/aquariophilie/blobfish` +> * Articles I wrote about my app
+> Add a link on a new line > - `https://gmacario.github.io/posts/2021-07-17-our-journey-to-do-mongodb-hackathon` > - `https://gmacario.github.io/posts/2021-07-20-blobfishes-submitted-to-mongodb-hackathon` From 74587943a35ffa329a811fadacd9c125f781b0cd Mon Sep 17 00:00:00 2001 From: Gianpaolo Macario Date: Tue, 20 Jul 2021 21:59:22 +0200 Subject: [PATCH 5/9] Add (optional) section: Register a DNS A record --- docs/deploy-blobfishes-to-digitalocean.md | 55 +++++++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/docs/deploy-blobfishes-to-digitalocean.md b/docs/deploy-blobfishes-to-digitalocean.md index 66ded32..9ae2979 100644 --- a/docs/deploy-blobfishes-to-digitalocean.md +++ b/docs/deploy-blobfishes-to-digitalocean.md @@ -9,7 +9,8 @@ - Create a new Project on DigitalOcean - Spin a MongoDB cluster on DigitalOcean - Create a Droplet on DigitalOcean - - Login to the VM via SSH + - Login to the VM via SSH and update OS + - (Optional) Register a DNS A record - Install Docker and `docker-compose` - Clone blobfishes sources from GitHub - Create file `.env` with connection info to the MongoDB instance @@ -352,14 +353,14 @@ As soon as the Droplet is created you should find its name with a green icon and -### Login to the VM via SSH +### Login to the VM via SSH and update OS Log in to the VM instance via SSH ```bash -ssh -i root@ +ssh -i root@ ``` Result: @@ -404,10 +405,54 @@ applicable law. root@ubuntu-s-1vcpu-1gb-fra1-01:~# ``` -TODO +Update the OS and reboot if requested + +```bash +sudo apt update && sudo apt -y dist-upgrade && sudo apt -y autoremove --purge +sudo reboot +``` + +### (Optional) Register a DNS A record + + + +If you have edit permissions on some DNS zones you may register an A record for the public IP address of the Droplet which you have just created. + +Example: "blobfish.aquariophilie.fun" --> 64.225.96.211 + +Notice that the DNS zone propagation may take a few minutes. + +Test that DNS update was successful + +```bash +ping blobfish.aquariophilie.fun +``` + +Result: + +```text +gmacario@gmpowerhorse:~ $ ping blobfish.aquariophilie.fun +PING blobfish.aquariophilie.fun (64.225.96.211) 56(84) bytes of data. +64 bytes from 64.225.96.211 (64.225.96.211): icmp_seq=1 ttl=49 time=25.3 ms +64 bytes from 64.225.96.211 (64.225.96.211): icmp_seq=2 ttl=49 time=24.0 ms +64 bytes from 64.225.96.211 (64.225.96.211): icmp_seq=3 ttl=49 time=24.5 ms +^C +--- blobfish.aquariophilie.fun ping statistics --- +3 packets transmitted, 3 received, 0% packet loss, time 2003ms +rtt min/avg/max/mdev = 24.021/24.590/25.282/0.522 ms +gmacario@gmpowerhorse:~ $ +``` + +Login to the VM via SSH to perform the next steps + +```bash +ssh -i root@blobfish.aquariophilie.fun +``` ### Install Docker and `docker-compose` +Follow the instructions at + TODO ### Clone blobfishes sources from GitHub @@ -468,6 +513,8 @@ TODO TODO +Open + ## Deploy blobfishes to DigitalOcean inside an App From beed7d00684a835976f83cb7dd0294533b3f10f6 Mon Sep 17 00:00:00 2001 From: Gianpaolo Macario Date: Tue, 20 Jul 2021 22:47:06 +0200 Subject: [PATCH 6/9] Document how to install docker and docker-compose --- docs/deploy-blobfishes-to-digitalocean.md | 240 +++++++++++++++++++++- 1 file changed, 235 insertions(+), 5 deletions(-) diff --git a/docs/deploy-blobfishes-to-digitalocean.md b/docs/deploy-blobfishes-to-digitalocean.md index 9ae2979..9be5857 100644 --- a/docs/deploy-blobfishes-to-digitalocean.md +++ b/docs/deploy-blobfishes-to-digitalocean.md @@ -449,19 +449,237 @@ Login to the VM via SSH to perform the next steps ssh -i root@blobfish.aquariophilie.fun ``` +Result: + +```text +gmacario@gmpowerhorse:~ $ ssh -i ~/.ssh/gmacario-gmail-com root@blobfish.aquariophilie.fun +Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-77-generic x86_64) + + * Documentation: https://help.ubuntu.com + * Management: https://landscape.canonical.com + * Support: https://ubuntu.com/advantage + + System information as of Tue Jul 20 20:02:58 UTC 2021 + + System load: 0.0 Users logged in: 0 + Usage of /: 7.5% of 24.06GB IPv4 address for eth0: 64.225.96.211 + Memory usage: 17% IPv4 address for eth0: 10.19.0.5 + Swap usage: 0% IPv4 address for eth1: 10.114.0.4 + Processes: 109 + +0 updates can be applied immediately. + + +Last login: Tue Jul 20 20:02:12 2021 from 93.43.242.87 +root@ubuntu-s-1vcpu-1gb-fra1-01:~# +``` + + ### Install Docker and `docker-compose` +#### Install Docker + Follow the instructions at -TODO +Prerequisites: Logged in on the VM + + + +```bash +ssh -i root@blobfish.aquariophilie.fun +``` + +Update packages and install Docker + +```bash +sudo apt update +sudo apt install apt-transport-https ca-certificates curl software-properties-common +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" +sudo apt update +apt-cache policy docker-ce +``` + +Result: + +```text +docker-ce: + Installed: (none) + Candidate: 5:20.10.7~3-0~ubuntu-focal + Version table: + 5:20.10.7~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:20.10.6~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:20.10.5~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:20.10.4~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:20.10.3~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:20.10.2~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:20.10.1~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:20.10.0~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:19.03.15~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:19.03.14~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:19.03.13~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:19.03.12~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:19.03.11~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:19.03.10~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages + 5:19.03.9~3-0~ubuntu-focal 500 + 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages +root@ubuntu-s-1vcpu-1gb-fra1-01:~# +``` + +Finally, install Docker: + +```bash +sudo apt install docker-ce +``` + +Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running: + +```bash +sudo systemctl status docker +``` + +The output should be similar to the following, showing that the service is active and running: + +``` +root@ubuntu-s-1vcpu-1gb-fra1-01:~# sudo systemctl status docker +● docker.service - Docker Application Container Engine + Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) + Active: active (running) since Tue 2021-07-20 20:12:51 UTC; 15min ago +TriggeredBy: ● docker.socket + Docs: https://docs.docker.com + Main PID: 2914 (dockerd) + Tasks: 8 + Memory: 41.8M + CGroup: /system.slice/docker.service + └─2914 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock + +Jul 20 20:12:50 ubuntu-s-1vcpu-1gb-fra1-01 dockerd[2914]: time="2021-07-20T20:12:50.841032999Z" level=warning msg="Your kernel does not support CPU realtime scheduler" +Jul 20 20:12:50 ubuntu-s-1vcpu-1gb-fra1-01 dockerd[2914]: time="2021-07-20T20:12:50.841357547Z" level=warning msg="Your kernel does not support cgroup blkio weight" +Jul 20 20:12:50 ubuntu-s-1vcpu-1gb-fra1-01 dockerd[2914]: time="2021-07-20T20:12:50.841554439Z" level=warning msg="Your kernel does not support cgroup blkio weight_device" +Jul 20 20:12:50 ubuntu-s-1vcpu-1gb-fra1-01 dockerd[2914]: time="2021-07-20T20:12:50.842164586Z" level=info msg="Loading containers: start." +Jul 20 20:12:51 ubuntu-s-1vcpu-1gb-fra1-01 dockerd[2914]: time="2021-07-20T20:12:51.034045414Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip c> +Jul 20 20:12:51 ubuntu-s-1vcpu-1gb-fra1-01 dockerd[2914]: time="2021-07-20T20:12:51.146664996Z" level=info msg="Loading containers: done." +Jul 20 20:12:51 ubuntu-s-1vcpu-1gb-fra1-01 dockerd[2914]: time="2021-07-20T20:12:51.233915455Z" level=info msg="Docker daemon" commit=b0f5bc3 graphdriver(s)=overlay2 version=20.10.7 +Jul 20 20:12:51 ubuntu-s-1vcpu-1gb-fra1-01 dockerd[2914]: time="2021-07-20T20:12:51.234615393Z" level=info msg="Daemon has completed initialization" +Jul 20 20:12:51 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: Started Docker Application Container Engine. +Jul 20 20:12:51 ubuntu-s-1vcpu-1gb-fra1-01 dockerd[2914]: time="2021-07-20T20:12:51.350939489Z" level=info msg="API listen on /run/docker.sock" +lines 1-21/21 (END) +``` + +Test: + +```bash +docker version +``` + +Result: + +```text +root@ubuntu-s-1vcpu-1gb-fra1-01:~# docker version +Client: Docker Engine - Community + Version: 20.10.7 + API version: 1.41 + Go version: go1.13.15 + Git commit: f0df350 + Built: Wed Jun 2 11:56:38 2021 + OS/Arch: linux/amd64 + Context: default + Experimental: true + +Server: Docker Engine - Community + Engine: + Version: 20.10.7 + API version: 1.41 (minimum version 1.12) + Go version: go1.13.15 + Git commit: b0f5bc3 + Built: Wed Jun 2 11:54:50 2021 + OS/Arch: linux/amd64 + Experimental: false + containerd: + Version: 1.4.8 + GitCommit: 7eba5930496d9bbe375fdf71603e610ad737d2b2 + runc: + Version: 1.0.0 + GitCommit: v1.0.0-0-g84113ee + docker-init: + Version: 0.19.0 + GitCommit: de40ad0 +root@ubuntu-s-1vcpu-1gb-fra1-01:~# +``` + +#### Install docker-compose + +Follow the instructions at + +Prerequisites: Docker already installed on your VM + +Logged in on the VM, install Docker Compose + +```bash +sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +sudo chmod +x /usr/local/bin/docker-compose +``` + +Verify that the installation was successful + +```bash +docker-compose --version +``` + +Result + +```text +root@ubuntu-s-1vcpu-1gb-fra1-01:~# docker-compose --version +docker-compose version 1.27.4, build 40524192 +root@ubuntu-s-1vcpu-1gb-fra1-01:~# +``` + ### Clone blobfishes sources from GitHub -TODO +```bash +mkdir -p ~/github/aquariophilie +cd ~/github/aquariophilie +git clone https://github.com/aquariophilie/blobfishes +``` + +Result + +```text +root@ubuntu-s-1vcpu-1gb-fra1-01:~# mkdir -p ~/github/aquariophilie +root@ubuntu-s-1vcpu-1gb-fra1-01:~# cd ~/github/aquariophilie +root@ubuntu-s-1vcpu-1gb-fra1-01:~/github/aquariophilie# git clone https://github.com/aquariophilie/blobfishes +Cloning into 'blobfishes'... +remote: Enumerating objects: 593, done. +remote: Counting objects: 100% (593/593), done. +remote: Compressing objects: 100% (441/441), done. +remote: Total 593 (delta 272), reused 376 (delta 122), pack-reused 0 +Receiving objects: 100% (593/593), 277.73 KiB | 16.34 MiB/s, done. +Resolving deltas: 100% (272/272), done. +root@ubuntu-s-1vcpu-1gb-fra1-01:~/github/aquariophilie# +``` + ### Create file `.env` with connection info to the MongoDB instance + + ```bash +cd ~/github/aquariophilie/blobfishes cp .env.example .env vi .env ``` @@ -475,20 +693,32 @@ MONGODB_URI=TODO MONGODB_USER=dbuser ``` -TODO ### Bring up blobfish webapp using `docker-compose` -TODO + ```bash +cd ~/github/aquariophilie/blobfishes docker-compose up -d ``` Result: ```text -TODO +root@ubuntu-s-1vcpu-1gb-fra1-01:~# cd ~/github/aquariophilie/blobfishes +root@ubuntu-s-1vcpu-1gb-fra1-01:~/github/aquariophilie/blobfishes# docker-compose up -d +Creating network "blobfishes_default" with the default driver +Building static-pages +Step 1/7 : FROM node:14.17.3-alpine +14.17.3-alpine: Pulling from librar +... +Successfully built 469fe99d09b2 +Successfully tagged blobfishes_server:latest +WARNING: Image for service server was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. +Creating blobfishes_static-pages_1 ... done +Creating blobfishes_server_1 ... done +root@ubuntu-s-1vcpu-1gb-fra1-01:~/github/aquariophilie/blobfishes# ``` ### Test blobfish webapp locally From 47869051df252057dc69984b4a95f461a5b8b4da Mon Sep 17 00:00:00 2001 From: Gianpaolo Macario Date: Tue, 20 Jul 2021 22:59:09 +0200 Subject: [PATCH 7/9] Complete section: Bring up blobfish webapp --- docs/deploy-blobfishes-to-digitalocean.md | 25 ++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/deploy-blobfishes-to-digitalocean.md b/docs/deploy-blobfishes-to-digitalocean.md index 9be5857..fc7abf0 100644 --- a/docs/deploy-blobfishes-to-digitalocean.md +++ b/docs/deploy-blobfishes-to-digitalocean.md @@ -194,7 +194,6 @@ Then click "Create a Database Cluster". -TODO ### Create a Droplet on DigitalOcean @@ -721,6 +720,30 @@ Creating blobfishes_server_1 ... done root@ubuntu-s-1vcpu-1gb-fra1-01:~/github/aquariophilie/blobfishes# ``` +Verify that the services are up and running + +```bash +docker-compose ps +``` + +Result: + +``` +root@ubuntu-s-1vcpu-1gb-fra1-01:~/github/aquariophilie/blobfishes# docker-compose ps + Name Command State Ports +-------------------------------------------------------------------------------------------------------------- +blobfishes_server_1 docker-entrypoint.sh node ... Up 0.0.0.0:3000->3000/tcp,:::3000->3000/tcp +blobfishes_static-pages_1 docker-entrypoint.sh ls -l ... Exit 0 +root@ubuntu-s-1vcpu-1gb-fra1-01:~/github/aquariophilie/blobfishes# +``` + +You can use "docker-compose logs ..." for troubleshooting services startup errors + +```bash +docker-compose logs +``` + + ### Test blobfish webapp locally TODO From 499cb9844c9763c395bb9772e0cde4990875fcf4 Mon Sep 17 00:00:00 2001 From: Gianpaolo Macario Date: Tue, 20 Jul 2021 23:03:38 +0200 Subject: [PATCH 8/9] Fill in section: Test blobfish webapp locally --- docs/deploy-blobfishes-to-digitalocean.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/deploy-blobfishes-to-digitalocean.md b/docs/deploy-blobfishes-to-digitalocean.md index fc7abf0..f38c387 100644 --- a/docs/deploy-blobfishes-to-digitalocean.md +++ b/docs/deploy-blobfishes-to-digitalocean.md @@ -746,7 +746,7 @@ docker-compose logs ### Test blobfish webapp locally -TODO + ```bash curl -v http://localhost:3000/ @@ -755,7 +755,26 @@ curl -v http://localhost:3000/ Result: ```text -TODO +root@ubuntu-s-1vcpu-1gb-fra1-01:~# curl -v http://localhost:3000/ +* Trying 127.0.0.1:3000... +* TCP_NODELAY set +* Connected to localhost (127.0.0.1) port 3000 (#0) +> GET / HTTP/1.1 +> Host: localhost:3000 +> User-Agent: curl/7.68.0 +> Accept: */* +> +* Mark bundle as not supporting multiuse +< HTTP/1.1 404 Not Found +< Vary: Origin +< Content-Type: text/plain; charset=utf-8 +< Content-Length: 9 +< Date: Tue, 20 Jul 2021 21:00:08 GMT +< Connection: keep-alive +< Keep-Alive: timeout=5 +< +* Connection #0 to host localhost left intact +root@ubuntu-s-1vcpu-1gb-fra1-01:~# ``` ### Open incoming ports on the VM From c444d9b55cf4be54d1a7a5b2f4b9004bc86dab9c Mon Sep 17 00:00:00 2001 From: Gianpaolo Macario Date: Tue, 20 Jul 2021 23:25:42 +0200 Subject: [PATCH 9/9] Minor changes to section titles --- docs/deploy-blobfishes-to-digitalocean.md | 79 +++++++++++++---------- 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/docs/deploy-blobfishes-to-digitalocean.md b/docs/deploy-blobfishes-to-digitalocean.md index f38c387..c79a8f4 100644 --- a/docs/deploy-blobfishes-to-digitalocean.md +++ b/docs/deploy-blobfishes-to-digitalocean.md @@ -5,20 +5,21 @@ * Introduction * Reference documents * Prerequisites -* Deploy blobfishes to DigitalOcean using Droplets +* Deploy blobfishes to DigitalOcean in a Droplet - Create a new Project on DigitalOcean - - Spin a MongoDB cluster on DigitalOcean - - Create a Droplet on DigitalOcean - - Login to the VM via SSH and update OS + - Spin a MongoDB cluster + - Create a Droplet + - Login via SSH and update OS - (Optional) Register a DNS A record - - Install Docker and `docker-compose` - - Clone blobfishes sources from GitHub - - Create file `.env` with connection info to the MongoDB instance - - Bring up blobfish webapp using `docker-compose` + - Install Docker + - Install Docker Compose + - Check out blobfishes sources + - Create and customize the `.env` file + - Bring up the blobfish webapp - Test blobfish webapp locally - Open incoming ports on the VM - - Test webapp remotely using a browser -* Deploy blobfishes to DigitalOcean inside an App + - Test webapp remotely using a browser + * See also @@ -52,7 +53,7 @@ This document explains how to perform a deployment of the blobfishes project to * A valid login to [DigitalOcean cloud](https://cloud.digitalocean.com/) * Access to blobfishes sources on GitHub -## Deploy blobfishes to DigitalOcean using Droplets +## Deploy blobfishes to DigitalOcean in a Droplet > Droplets? Are we spreading COVID-19 disease again??? @@ -99,7 +100,7 @@ Click "Skip for now". Click "Remind me later". -### Spin a MongoDB cluster on DigitalOcean +### Spin a MongoDB cluster Logged into the DigitalOcean console, expand section "MANAGE", then click "Databases". @@ -195,7 +196,7 @@ Then click "Create a Database Cluster". -### Create a Droplet on DigitalOcean +### Create a Droplet @@ -352,7 +353,7 @@ As soon as the Droplet is created you should find its name with a green icon and -### Login to the VM via SSH and update OS +### Login via SSH and update OS @@ -417,26 +418,26 @@ sudo reboot If you have edit permissions on some DNS zones you may register an A record for the public IP address of the Droplet which you have just created. -Example: "blobfish.aquariophilie.fun" --> 64.225.96.211 +Example: "blobfishes.aquariophilie.fun" --> 64.225.96.211 Notice that the DNS zone propagation may take a few minutes. Test that DNS update was successful ```bash -ping blobfish.aquariophilie.fun +ping blobfishes.aquariophilie.fun ``` Result: ```text -gmacario@gmpowerhorse:~ $ ping blobfish.aquariophilie.fun -PING blobfish.aquariophilie.fun (64.225.96.211) 56(84) bytes of data. +gmacario@gmpowerhorse:~ $ ping blobfishes.aquariophilie.fun +PING blobfishes.aquariophilie.fun (64.225.96.211) 56(84) bytes of data. 64 bytes from 64.225.96.211 (64.225.96.211): icmp_seq=1 ttl=49 time=25.3 ms 64 bytes from 64.225.96.211 (64.225.96.211): icmp_seq=2 ttl=49 time=24.0 ms 64 bytes from 64.225.96.211 (64.225.96.211): icmp_seq=3 ttl=49 time=24.5 ms ^C ---- blobfish.aquariophilie.fun ping statistics --- +--- blobfishes.aquariophilie.fun ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 24.021/24.590/25.282/0.522 ms gmacario@gmpowerhorse:~ $ @@ -445,7 +446,7 @@ gmacario@gmpowerhorse:~ $ Login to the VM via SSH to perform the next steps ```bash -ssh -i root@blobfish.aquariophilie.fun +ssh -i root@blobfishes.aquariophilie.fun ``` Result: @@ -474,9 +475,7 @@ root@ubuntu-s-1vcpu-1gb-fra1-01:~# ``` -### Install Docker and `docker-compose` - -#### Install Docker +### Install Docker Follow the instructions at @@ -485,7 +484,7 @@ Prerequisites: Logged in on the VM ```bash -ssh -i root@blobfish.aquariophilie.fun +ssh -i root@blobfishes.aquariophilie.fun ``` Update packages and install Docker @@ -620,7 +619,7 @@ Server: Docker Engine - Community root@ubuntu-s-1vcpu-1gb-fra1-01:~# ``` -#### Install docker-compose +### Install Docker Compose Follow the instructions at @@ -648,7 +647,9 @@ root@ubuntu-s-1vcpu-1gb-fra1-01:~# ``` -### Clone blobfishes sources from GitHub +### Check out blobfishes sources + +Check out the blobfishes sources from GitHub: ```bash mkdir -p ~/github/aquariophilie @@ -673,30 +674,34 @@ root@ubuntu-s-1vcpu-1gb-fra1-01:~/github/aquariophilie# ``` -### Create file `.env` with connection info to the MongoDB instance +### Create and customize the `.env` file +Create the `.env` file starting from `.env.example`: + ```bash cd ~/github/aquariophilie/blobfishes cp .env.example .env vi .env ``` -Edit the `MONGODB_xxx` variables - example: +Edit the `MONGODB_xxx` variables with the information for connecting to the MongoDB instance - example: ```text -MONGODB_NAME=TODO +MONGODB_NAME=blobfishes MONGODB_PASS=dbpass MONGODB_URI=TODO MONGODB_USER=dbuser ``` -### Bring up blobfish webapp using `docker-compose` +### Bring up the blobfish webapp +Bring up the blobfish webapp using `docker-compose up` + ```bash cd ~/github/aquariophilie/blobfishes docker-compose up -d @@ -779,22 +784,26 @@ root@ubuntu-s-1vcpu-1gb-fra1-01:~# ### Open incoming ports on the VM -TODO +**NOTE**: This step is not necessary with DigitalOcean. -### Test webapp remotely using a browser -TODO +### Test webapp remotely using a browser + + -Open +Open from your favourite browser. + + ## See also -TODO +*