@@ -11,12 +11,24 @@ tasks:
11
11
desc : Install the project
12
12
cmds :
13
13
- task _show_preinstall_notes
14
+ - task _version_file
14
15
- task _prepare_nginx_conf # Add this step to prepare nginx.conf
15
16
- echo "Installing"
16
17
- docker compose --env-file .env -f compose.yml pull
17
18
- docker compose --env-file .env -f compose.yml up --force-recreate --detach --remove-orphans
18
19
- task _show_notes
19
20
21
+ upgrade :
22
+ desc : Upgrades the admin site to a newer version
23
+ cmds :
24
+ - task _show_upgrade_notes
25
+ - task _version_file
26
+ - task stop
27
+ - docker compose --env-file .env -f compose.yml down
28
+ - docker compose --env-file .env -f compose.yml pull
29
+ - docker compose --env-file .env -f compose.yml up --force-recreate --detach --remove-orphans
30
+ - task _show_notes
31
+
20
32
reinstall :
21
33
desc : Reinstall from scratch. Removes the database, all containers, and volumes.
22
34
deps :
@@ -30,6 +42,11 @@ tasks:
30
42
- stop
31
43
cmds :
32
44
- docker compose --env-file .env -f compose.yml down -v
45
+ - |
46
+ if [ -f VERSION ]; then
47
+ rm VERSION
48
+ echo "VERSION file deleted."
49
+ fi
33
50
34
51
up :
35
52
desc : Take the environment up without altering the existing state of the containers
@@ -41,6 +58,28 @@ tasks:
41
58
cmds :
42
59
- docker compose --env-file .env -f compose.yml stop
43
60
61
+ _show_upgrade_notes :
62
+ cmds :
63
+ - |
64
+ VERSION=$(grep ^VERSION= .env | cut -d '=' -f 2)
65
+ if [ -f VERSION ] && [ "$(cat VERSION)" = "$VERSION" ]; then
66
+ echo ""
67
+ echo "===================================================="
68
+ echo "It looks like version $VERSION is already installed."
69
+ echo "To set the version you want to upgrade to, edit the VERSION value in .env."
70
+ echo "===================================================="
71
+ exit 0
72
+ fi
73
+ echo ""
74
+ echo "===================================================="
75
+ echo "You are about to upgrade to version $VERSION."
76
+ echo "===================================================="
77
+ echo "Are you sure you want to continue? (yes/no)"
78
+ read answer && case $answer in
79
+ [Yy][Ee][Ss]) ;;
80
+ *) echo "Upgrade canceled."; exit 1;;
81
+ esac
82
+
44
83
_show_preinstall_notes :
45
84
cmds :
46
85
- echo ""
49
88
- echo "===================================================="
50
89
- echo ""
51
90
- echo "To proceed with the installation, ensure the following steps are completed:"
52
- - echo "1. Update '.env'"
91
+ - echo "1. Update '.env'. Change the passwords and secret keys. "
53
92
- echo "2. Place your SSL certificate files ('nginx.crt' and 'nginx.key') in the 'ssl' directory."
54
93
- echo ""
55
94
- echo "Have you completed the above pre-installation steps? (yes/no)"
@@ -66,13 +105,28 @@ tasks:
66
105
DOMAIN=$(grep ^DOMAIN= .env | cut -d '=' -f 2)
67
106
sed -i "s/\${DOMAIN}/$DOMAIN/g" nginx.conf
68
107
108
+ _version_file :
109
+ desc : Write the value of VERSION from .env to a file called VERSION
110
+ cmds :
111
+ - |
112
+ VERSION=$(grep ^VERSION= .env | cut -d '=' -f 2)
113
+ echo $VERSION > VERSION
114
+ echo "VERSION file updated with value: $VERSION"
115
+
69
116
_show_notes :
70
117
cmds :
71
118
- |
72
119
DOMAIN=$(grep ^DOMAIN= .env | cut -d '=' -f 2)
120
+ ADMIN_USERNAME=$(grep ^ADMIN_USERNAME= .env | cut -d '=' -f 2)
121
+ ADMIN_PASSWORD=$(grep ^ADMIN_PASSWORD= .env | cut -d '=' -f 2)
73
122
echo ""
74
123
echo "===================================================="
75
- echo "OS2Borgerpc Admin is now is available via the URLs below"
124
+ echo "OS2Borgerpc Admin is now available via the URLs below"
76
125
echo "===================================================="
77
126
echo "Admin: https://$DOMAIN"
127
+ echo "Django Backend: https://$DOMAIN/admin"
128
+ echo "===================================================="
129
+ echo "You can log in with the following credentials:"
130
+ echo "Username: $ADMIN_USERNAME"
131
+ echo "Password: $ADMIN_PASSWORD"
78
132
echo "===================================================="
0 commit comments