File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -90,13 +90,25 @@ jobs:
90
90
91
91
# Create a postinstall script that enables all the shipped units
92
92
# and symlinks our nginx configuration in place of the default one.
93
+ # We also set up the database user in this block
93
94
echo "#/bin/sh" > postinstall.sh
94
95
for f in ./systemd/*; do
95
96
echo "systemctl enable $(basename $f)" >> postinstall.sh
96
97
done
97
98
echo "ln -sf /opt/hackman/nginx/default /etc/nginx/sites-enabled/default" >> postinstall.sh
99
+
100
+ # Ugly auto-generated escape sequences galore! \o/
101
+ echo 'echo '"'"'CREATE DATABASE hackman;'"'"' | sudo -u postgres psql' >> postinstall.sh
102
+ echo 'echo '"'"'CREATE USER hackman WITH PASSWORD '"'"'"'"'"'"'"'"'hackman'"'"'"'"'"'"'"'"';'"'"' | sudo -u postgres psql' >> postinstall.sh
103
+ echo 'echo '"'"'ALTER ROLE hackman SET client_encoding TO '"'"'"'"'"'"'"'"'utf8'"'"'"'"'"'"'"'"';'"'"' | sudo -u postgres psql' >> postinstall.sh
104
+ echo 'echo '"'"'ALTER ROLE hackman SET default_transaction_isolation TO '"'"'"'"'"'"'"'"'read committed'"'"'"'"'"'"'"'"';'"'"' | sudo -u postgres psql' >> postinstall.sh
105
+ echo 'echo '"'"'ALTER ROLE hackman SET timezone TO '"'"'"'"'"'"'"'"'UTC'"'"'"'"'"'"'"'"';'"'"' | sudo -u postgres psql' >> postinstall.sh
106
+ echo 'echo '"'"'GRANT ALL PRIVILEGES ON DATABASE hackman TO hackman;'"'"' | sudo -u postgres psql' >> postinstall.sh
107
+
108
+ # Reload main systemd units
98
109
echo "systemctl start hackman" >> postinstall.sh
99
110
echo "systemctl reload nginx" >> postinstall.sh
111
+
100
112
chmod +x postinstall.sh
101
113
102
114
# Build deb
Original file line number Diff line number Diff line change @@ -49,8 +49,12 @@ def _gen_key() -> str:
49
49
50
50
DATABASES = {
51
51
"default" : {
52
- "ENGINE" : "django.db.backends.sqlite3" ,
53
- "NAME" : "/var/lib/hackman/db.sqlite3" ,
52
+ "ENGINE" : "django.db.backends.postgresql" ,
53
+ "NAME" : "hackman" ,
54
+ "USER" : "hackman" ,
55
+ "PASSWORD" : "hackman" ,
56
+ "HOST" : "localhost" ,
57
+ "PORT" : "" ,
54
58
}
55
59
}
56
60
You can’t perform that action at this time.
0 commit comments