Skip to content

Commit 600771d

Browse files
committed
Add taskfile for installation tasks
1 parent 50b2f95 commit 600771d

File tree

5 files changed

+90
-7
lines changed

5 files changed

+90
-7
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
DOMAIN=display-devs.sonderborg.dk
2+
3+
VERSION=7.0.1
4+
15
# Database host
26
DB_HOST=db
37

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.env
22
*.crt
33
*.cer
4-
*.key
4+
*.key
5+
nginx.conf

Taskfile.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
version: '3'
2+
silent: true
3+
4+
tasks:
5+
default:
6+
desc: The default task that shows help
7+
cmds:
8+
- task --list
9+
10+
install:
11+
desc: Install the project
12+
cmds:
13+
- task _show_preinstall_notes
14+
- task _prepare_nginx_conf # Add this step to prepare nginx.conf
15+
- echo "Installing"
16+
- docker compose --env-file .env -f compose.yml pull
17+
- docker compose --env-file .env -f compose.yml up --force-recreate --detach --remove-orphans
18+
- task _show_notes
19+
20+
reinstall:
21+
desc: Reinstall from scratch. Removes the database, all containers, and volumes.
22+
deps:
23+
- down
24+
cmds:
25+
- task install
26+
27+
down:
28+
desc: Remove all containers and volumes
29+
deps:
30+
- stop
31+
cmds:
32+
- docker compose --env-file .env -f compose.yml down -v
33+
34+
up:
35+
desc: Take the environment up without altering the existing state of the containers
36+
cmds:
37+
- docker compose --env-file .env -f compose.yml up -d
38+
39+
stop:
40+
desc: Stop all containers without altering anything else
41+
cmds:
42+
- docker compose --env-file .env -f compose.yml stop
43+
44+
_show_preinstall_notes:
45+
cmds:
46+
- echo ""
47+
- echo "===================================================="
48+
- echo "Pre-installation Requirements"
49+
- echo "===================================================="
50+
- echo ""
51+
- echo "To proceed with the installation, ensure the following steps are completed:"
52+
- echo "1. Update '.env'"
53+
- echo "2. Place your SSL certificate files ('nginx.crt' and 'nginx.key') in the 'ssl' directory."
54+
- echo ""
55+
- echo "Have you completed the above pre-installation steps? (yes/no)"
56+
- |
57+
read answer && case $answer in
58+
[Yy][Ee][Ss]) ;;
59+
*) echo "Please complete the pre-install tasks before continuing."; exit 1;;
60+
esac
61+
62+
_prepare_nginx_conf:
63+
cmds:
64+
- cp example.nginx.conf nginx.conf
65+
- |
66+
DOMAIN=$(grep ^DOMAIN= .env | cut -d '=' -f 2)
67+
sed -i "s/\${DOMAIN}/$DOMAIN/g" nginx.conf
68+
69+
_show_notes:
70+
cmds:
71+
- |
72+
DOMAIN=$(grep ^DOMAIN= .env | cut -d '=' -f 2)
73+
echo ""
74+
echo "===================================================="
75+
echo "OS2Borgerpc Admin is now is available via the URLs below"
76+
echo "===================================================="
77+
echo "Admin: https://$DOMAIN"
78+
echo "===================================================="

compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ networks:
66
internal: false
77
services:
88
os2borgerpc-admin:
9-
image: ghcr.io/os2borgerpc/os2borgerpc-admin-site:7.0.1
9+
image: ghcr.io/os2borgerpc/os2borgerpc-admin-site:${VERSION}
1010
restart: unless-stopped
1111
networks:
1212
- app
@@ -50,9 +50,9 @@ services:
5050
networks:
5151
- app
5252
environment:
53-
POSTGRES_USER=${DB_USER}
54-
POSTGRES_PASSWORD=${DB_PASSWORD}
55-
POSTGRES_DB=${DB_NAME}
53+
POSTGRES_USER: ${DB_USER}
54+
POSTGRES_PASSWORD: ${DB_PASSWORD}
55+
POSTGRES_DB: ${DB_NAME}
5656
volumes:
5757
- postgres-data:/var/lib/postgresql/data
5858
nginx:

nginx.conf renamed to example.nginx.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ events {
55
http {
66
server {
77
listen 80;
8-
server_name demo.os2borgerpc.dk;
8+
server_name ${DOMAIN};
99

1010
location / {
1111
return 301 https://$host$request_uri;
@@ -14,7 +14,7 @@ http {
1414

1515
server {
1616
listen 443 ssl;
17-
server_name demo.os2borgerpc.dk;
17+
server_name ${DOMAIN};
1818

1919
ssl_certificate /etc/nginx/ssl/nginx.crt;
2020
ssl_certificate_key /etc/nginx/ssl/nginx.key;

0 commit comments

Comments
 (0)