Updated to newest Docker version syntax

This commit is contained in:
Vivek Santayana 2022-06-17 10:28:34 +01:00
parent 25115a6fae
commit 73f31016fd
2 changed files with 16 additions and 12 deletions

View File

@ -16,7 +16,7 @@ The clien is designed to work on a server.
- A Debian- or Ubuntu-based server, preferably the latest distribution. - A Debian- or Ubuntu-based server, preferably the latest distribution.
- Docker (specifically, Docker Engine) - Docker (specifically, Docker Engine)
- Docker-Compose - Docker Compose
- Git - Git
### Installation ### Installation
@ -28,9 +28,13 @@ The first step is to ensure all the prerequisites are available on the server.
To set up the server, consult some of the comprehensive guides on various hosting platforms like Linode or DigitalOcean. To set up the server, consult some of the comprehensive guides on various hosting platforms like Linode or DigitalOcean.
Here is a [good starting point on setting up a server](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-22-04). Here is a [good starting point on setting up a server](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-22-04).
To install Docker and Docker-Compose, consult the respective documentation: To install Docker and Docker Compose, consult the respective documentation:
- [Install on Ubuntu](https://docs.docker.com/engine/install/ubuntu/) or [Install on Debian](https://docs.docker.com/engine/install/debian/) - [Install on Ubuntu](https://docs.docker.com/engine/install/ubuntu/) or [Install on Debian](https://docs.docker.com/engine/install/debian/)
- [Install Docker-Compose](https://github.com/docker/compose) as per these instructions. - Docker Compose should be installed as part of that.
```
At the time of writing, there has been an upgrade to Docker and Docker Compose, meaning the syntax below might be different between versions.
```
Check if Git is installed on your server using the `git --version` command. Check if Git is installed on your server using the `git --version` command.
If it isn't installed, install it. If it isn't installed, install it.
@ -131,7 +135,7 @@ Everything should be good to run on autopilot at this point.
Navigate to the root folder of the app, the folder where you have `install-script.sh` and `docker-compose.yml`. Navigate to the root folder of the app, the folder where you have `install-script.sh` and `docker-compose.yml`.
Run the following command: Run the following command:
```sudo docker-compose up -d``` ```sudo docker compose up -d```
And you should have the stack running. And you should have the stack running.
You can register in the app and begin using it. You can register in the app and begin using it.

View File

@ -2,8 +2,8 @@
# Source https://pentacent.medium.com/nginx-and-lets-encrypt-with-docker-in-less-than-5-minutes-b4b8a60d3a71 # Source https://pentacent.medium.com/nginx-and-lets-encrypt-with-docker-in-less-than-5-minutes-b4b8a60d3a71
if ! [ -x "$(command -v docker-compose)" ]; then if ! [ -x "$(command -v docker compose)" ]; then
echo 'Error: docker-compose is not installed.' >&2 echo 'Error: docker compose is not installed.' >&2
exit 1 exit 1
fi fi
@ -22,7 +22,7 @@ fi
if [ ! -e "$data_path/ssl-dhparams.pem" ]; then if [ ! -e "$data_path/ssl-dhparams.pem" ]; then
echo "### Generating ssl-dhparams.pem ..." echo "### Generating ssl-dhparams.pem ..."
docker-compose run --rm --entrypoint "\ docker compose run --rm --entrypoint "\
openssl dhparam 4096 -out /etc/letsencrypt/ssl-dhparams.pem" certbot openssl dhparam 4096 -out /etc/letsencrypt/ssl-dhparams.pem" certbot
echo echo
fi fi
@ -30,7 +30,7 @@ fi
echo "### Creating dummy certificate for $domains ..." echo "### Creating dummy certificate for $domains ..."
path="/etc/letsencrypt/live/$domains" path="/etc/letsencrypt/live/$domains"
mkdir -p "$data_path/conf/live/$domains" mkdir -p "$data_path/conf/live/$domains"
docker-compose run --rm --entrypoint "\ docker compose run --rm --entrypoint "\
openssl req -x509 -nodes -newkey rsa:$rsa_key_size -days 1\ openssl req -x509 -nodes -newkey rsa:$rsa_key_size -days 1\
-keyout '$path/privkey.pem' \ -keyout '$path/privkey.pem' \
-out '$path/fullchain.pem' \ -out '$path/fullchain.pem' \
@ -38,11 +38,11 @@ docker-compose run --rm --entrypoint "\
echo echo
echo "### Starting nginx ..." echo "### Starting nginx ..."
docker-compose up --force-recreate -d nginx docker compose up --force-recreate -d nginx
echo echo
echo "### Deleting dummy certificate for $domains ..." echo "### Deleting dummy certificate for $domains ..."
docker-compose run --rm --entrypoint "\ docker compose run --rm --entrypoint "\
rm -Rf /etc/letsencrypt/live/$domains && \ rm -Rf /etc/letsencrypt/live/$domains && \
rm -Rf /etc/letsencrypt/archive/$domains && \ rm -Rf /etc/letsencrypt/archive/$domains && \
rm -Rf /etc/letsencrypt/renewal/$domains.conf" certbot rm -Rf /etc/letsencrypt/renewal/$domains.conf" certbot
@ -64,7 +64,7 @@ esac
# Enable staging mode if needed # Enable staging mode if needed
if [ $staging != "0" ]; then staging_arg="--staging"; fi if [ $staging != "0" ]; then staging_arg="--staging"; fi
docker-compose run --rm --entrypoint "\ docker compose run --rm --entrypoint "\
certbot certonly --webroot -w /var/www/certbot \ certbot certonly --webroot -w /var/www/certbot \
$staging_arg \ $staging_arg \
$email_arg \ $email_arg \
@ -75,4 +75,4 @@ docker-compose run --rm --entrypoint "\
echo echo
echo "### Reloading nginx ..." echo "### Reloading nginx ..."
docker-compose exec nginx nginx -s reload docker compose exec nginx nginx -s reload