Skip to content

Commit e13186d

Browse files
authored
Merge branch 'main' into dev
2 parents 93df661 + c35345a commit e13186d

File tree

5 files changed

+66
-3
lines changed

5 files changed

+66
-3
lines changed

build-images.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ images=()
1414
repobase="${REPOBASE:-ghcr.io/geniusdynamics}"
1515
# Configure the image name
1616
reponame="firefly"
17+
firefly_version="version-6.2.20"
1718

1819
# Create a new empty container image
1920
container=$(buildah from scratch)
@@ -45,7 +46,7 @@ buildah config --entrypoint=/ \
4546
--label="org.nethserver.authorizations=traefik@node:routeadm" \
4647
--label="org.nethserver.tcp-ports-demand=1" \
4748
--label="org.nethserver.rootfull=0" \
48-
--label="org.nethserver.images=docker.io/postgres:15.5-alpine3.19 docker.io/fireflyiii/core:latest" \
49+
--label="org.nethserver.images=docker.io/postgres:15.5-alpine3.19 docker.io/fireflyiii/core:$firefly_version" \
4950
"${container}"
5051
# Commit the image
5152
buildah commit "${container}" "${repobase}/${reponame}"

imageroot/actions/configure-module/10configure_environment_vars

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ APP_URL = data.get("host", "")
2121
app = {
2222
"APP_URL": "https://"+APP_URL,
2323
}
24-
25-
agent.write_envfile("app.env", app)
24+
agent.write_envfile("app_config.env", app)
2625

2726
#agent.dump_env()
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env python3
2+
3+
#
4+
# Copyright (C) 2022 Nethesis S.r.l.
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
#
7+
8+
import json
9+
import sys
10+
import agent
11+
import base64
12+
import os
13+
14+
# Try to parse the stdin as JSON.
15+
# If parsing fails, output everything to stderr
16+
data = json.load(sys.stdin)
17+
def generate_random_password(length):
18+
# Generate random bytes and convert them to a hexadecimal string
19+
random_bytes = os.urandom(length)
20+
password = random_bytes.hex()
21+
return password[:length]
22+
23+
#This is specific to you module, so you need to change it accordingly.
24+
# we read a json stdin {"vars1":true, "var2":"foo", "vars3": 3} and we writ it to .config/state/environment
25+
# Setup database
26+
POSTGRES_USER= data.get("POSTGRES_USER", "postgres")
27+
POSTGRES_PASSWORD= generate_random_password(16)
28+
POSTGRES_DB= data.get("POSTGRES_DB", "firefly")
29+
30+
db = {
31+
"POSTGRES_USER": POSTGRES_USER,
32+
"POSTGRES_PASSWORD": POSTGRES_PASSWORD,
33+
"POSTGRES_DB": POSTGRES_DB,
34+
}
35+
agent.write_envfile("database.env", db)
36+
37+
38+
random_bytes = os.urandom(32)
39+
base64_bytes = base64.b64encode(random_bytes)
40+
base64_message = base64_bytes.decode('utf-8')
41+
APP_KEY = "base64:" + base64_message
42+
DB_HOST="postgresql-app"
43+
DB_USERNAME=POSTGRES_USER
44+
DB_PASSWORD=POSTGRES_PASSWORD
45+
app = {
46+
"APP_KEY": APP_KEY,
47+
"DB_HOST": DB_HOST,
48+
"DB_USERNAME": DB_USERNAME,
49+
"DB_PASSWORD": DB_PASSWORD,
50+
"DB_DATABASE": POSTGRES_DB,
51+
"DB_CONNECTION": "pgsql",
52+
"DB_PORT": "5432",
53+
"TRUSTED_PROXIES": "*",
54+
}
55+
56+
agent.write_envfile("app.env", app)
57+
58+
#agent.dump_env()

imageroot/etc/state-include.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55
# List here what you want to save during backup : volumes or file Path
66

77

8+
89
state/firefly.pg_dump
910
state/app.env
1011
state/app-db.env
12+
state/app_config.env
1113
state/database.env
1214
volumes/firefly_iii_upload
15+
volumes/firefly-app
16+
1317

imageroot/systemd/user/firefly-app.service

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ExecStart=/usr/bin/podman run --conmon-pidfile %t/firefly-app.pid \
2323
--pod-id-file %t/firefly.pod-id --replace -d --name firefly-app \
2424
--env-file=%S/state/app.env \
2525
--env-file=%S/state/app-db.env \
26+
--env-file=%S/state/app_config.env \
2627
--volume firefly_iii_upload:/var/www/html/storage/upload/:Z \
2728
${CORE_IMAGE}
2829
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/firefly-app.ctr-id -t 10

0 commit comments

Comments
 (0)