Skip to content

Ubuntu VPS development setup

Rick van der Zwet edited this page Nov 30, 2022 · 2 revisions

The setup mentioned in Development environment works great for local development. If you how-ever want to setup your development instance on a public facing system, for example a Ubuntu VPS system, a few tweaks are required.

First and foremost ensure your VPS have enough resources (minimum of 2GB and 1CPU, recommended 4GB, 2CPU), else you end up fighting all kind of weird and wonderful errors, for example db container failing to start since database software (mysql) is running out-of-memory.

Secondly you will need to ensure the hashtopolis container is able to write to your local checkout. The can be done by

  1. either start under user with UID (1001)
  2. modify your .devcontainer/Dockerfile and alter UID of user vscode
  3. Apply the patch below and run as root (not recommended, though):
root@vps:~/hashtopolis-server/.devcontainer# git diff
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 6c5bb46a..6255b2ce 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -57,7 +57,7 @@ RUN groupadd vscode && useradd -rm -d /var/www -s /bin/bash -g vscode -G www-dat
     && chmod g+w /var/www

 WORKDIR /var/www
-USER vscode
+USER root

 # Switch back to dialog for any ad-hoc use of apt-get
 ENV DEBIAN_FRONTEND=dialog
$ cd .devcontainer
$ docker-compose up
# Alternative start in detached mode
$ docker-compose up -d

Security notice

Your newly created hashtopolis development instance will be running with default credentials, also the mysql server running will by default be exposed to the internet even with ufw enabled, for more details on the why read the article How To Use Docker with a UFW Firewall by Anthony Heddings.

TL;DR; Only expose docker hashtopolis HTTP webinterface:

$ sudo wget -O /usr/local/bin/ufw-docker https://github.com/chaifeng/ufw-docker/raw/master/ufw-docker
$ sudo chmod +x /usr/local/bin/ufw-docker

$ ufw-docker install
$ sudo systemctl restart ufw

$ ufw-docker allow hashtopolis 80/tcp