File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ #
4
+ # Copyright (C) 2023 Nethesis S.r.l.
5
+ # SPDX-License-Identifier: GPL-3.0-or-later
6
+ #
7
+
8
+ import sys
9
+ import agent
10
+ import os
11
+
12
+ # Connect the local Redis replica. This is necessary to consistently start
13
+ database = "database.env"
14
+ # check if it exists
15
+ # set the default values
16
+
17
+ if not os .path .exists (database ):
18
+ POSTGRES_DB = "paperless"
19
+ POSTGRES_USER = "paperless"
20
+ POSTGRES_PASSWORD = "p@perle$$"
21
+ paperless_config = {
22
+ "PAPERLESS_DBENGINE" : "postgresql" ,
23
+ "PAPERLESS_DBHOST" : "paperless-pgsql" ,
24
+ "PAPERLESS_DBNAME" : POSTGRES_DB ,
25
+ "PAPERLESS_DBUSER" : POSTGRES_USER ,
26
+ "PAPERLESS_DBPASS" : POSTGRES_PASSWORD ,
27
+ }
28
+ agent .write_envfile ("paperless-db.env" , paperless_config )
29
+ PAPERLESS_SECRET_KEY = os .getenv ("PAPERLESS_SECRET_KEY" , "" )
30
+ secret_key = {
31
+ "PAPERLESS_SECRET_KEY" : PAPERLESS_SECRET_KEY ,
32
+ }
33
+ agent .write_envfile ("secret_key.env" , secret_key )
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ WorkingDirectory=%S/state
19
19
Restart =always
20
20
ExecStartPre =/bin/rm -f %t/ns8-paperless-ngx.pid %t/ns8-paperless-ngx.ctr-id
21
21
ExecStartPre =/usr/local/bin/runagent discover-smarthost
22
+ ExecStartPre =/usr/local/bin/runagent discover-database
22
23
ExecStart =/usr/bin/podman run \
23
24
--detach \
24
25
--conmon-pidfile =%t/ns8-paperless-ngx.pid \
You can’t perform that action at this time.
0 commit comments