Skip to content

Commit c35345a

Browse files
authored
Merge pull request #2 from wanjikumaureen12/main
updated to v6.2.20
2 parents fd69f08 + 0d8b160 commit c35345a

File tree

5 files changed

+69
-28
lines changed

5 files changed

+69
-28
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: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,16 @@ data = json.load(sys.stdin)
1717

1818
#This is specific to you module, so you need to change it accordingly.
1919
# we read a json stdin {"vars1":true, "var2":"foo", "vars3": 3} and we writ it to .config/state/environment
20-
# Setup database
21-
POSTGRES_USER= data.get("POSTGRES_USER", "postgres")
22-
POSTGRES_PASSWORD= data.get("POSTGRES_PASSWORD", "Nethesis@1234")
23-
POSTGRES_DB= data.get("POSTGRES_DB", "firefly")
24-
25-
db = {
26-
"POSTGRES_USER": POSTGRES_USER,
27-
"POSTGRES_PASSWORD": POSTGRES_PASSWORD,
28-
"POSTGRES_DB": POSTGRES_DB,
29-
}
30-
agent.write_envfile("database.env", db)
3120

3221

33-
random_bytes = os.urandom(32)
34-
base64_bytes = base64.b64encode(random_bytes)
35-
base64_message = base64_bytes.decode('utf-8')
36-
APP_KEY = "base64:" + base64_message
37-
DB_HOST="postgresql-app"
38-
DB_USERNAME=POSTGRES_USER
39-
DB_PASSWORD=POSTGRES_PASSWORD
22+
4023
APP_URL = data.get("host", "")
4124
app = {
42-
"APP_KEY": APP_KEY,
43-
"DB_HOST": DB_HOST,
44-
"DB_USERNAME": DB_USERNAME,
45-
"DB_PASSWORD": DB_PASSWORD,
46-
"DB_DATABASE": POSTGRES_DB,
25+
4726
"APP_URL": "https://"+APP_URL,
48-
"DB_CONNECTION": "pgsql",
49-
"DB_PORT": "5432",
50-
"TRUSTED_PROXIES": "*",
27+
5128
}
5229

53-
agent.write_envfile("app.env", app)
30+
agent.write_envfile("app_config.env", app)
5431

5532
#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
@@ -6,5 +6,9 @@
66

77

88
state/firefly.sql
9+
state/database.env
10+
state/app.env
11+
state/app_config.env
12+
volumes/firefly_iii_upload
913
volumes/firefly-app
1014

imageroot/systemd/user/firefly-app.service

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

0 commit comments

Comments
 (0)