Skip to content

Commit

Permalink
removed configurator and bash commands
Browse files Browse the repository at this point in the history
  • Loading branch information
kemboi22 committed Jul 23, 2024
1 parent 048fcb5 commit 147eef9
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 32 deletions.
9 changes: 9 additions & 0 deletions imageroot/systemd/user/backend.service
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ ExecStart=/usr/bin/podman run --conmon-pidfile %t/backend.pid \
-v sites:/home/frappe/frappe-bench/sites \
-v logs:/home/frappe/frappe-bench/logs \
${ERPNEXT_IMAGE}
ExecStartPost=/usr/bin/podman exec backend /bin/bash -c ' \
ls -1 apps > sites/apps.txt; \
bench set-config -g db_host "db"; \
bench set-config -gp db_port "3306"; \
bench set-config -g redis_cache "redis://redis-cache:6379"; \
bench set-config -g redis_queue "redis://redis-cache:6379"; \
bench set-config -g redis_socketio "redis://redis-cache:6379"; \
bench set-config -gp socketio_port "9000"; \
'
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/backend.ctr-id -t 10
ExecReload=/usr/bin/podman kill -s HUP backend
SyslogIdentifier=%u
Expand Down
19 changes: 10 additions & 9 deletions imageroot/systemd/user/configurator.service
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ ExecStart=/usr/bin/podman run --conmon-pidfile %t/configurator.pid \
-e REDIS_CACHE=redis-cache:6379 \
-e REDIS_QUEUE=redis-cache:6379 \
-e SOCKETIO_PORT=9000 \
${ERPNEXT_IMAGE} /bin/bash -c ' \
ls -1 apps > sites/apps.txt; \
bench set-config -g db_host "$DB_HOST"; \
bench set-config -gp db_port "$DB_PORT"; \
bench set-config -g redis_cache "redis://$REDIS_CACHE"; \
bench set-config -g redis_queue "redis://$REDIS_QUEUE"; \
bench set-config -g redis_socketio "redis://$REDIS_QUEUE"; \
bench set-config -gp socketio_port "$SOCKETIO_PORT"; \
'
${ERPNEXT_IMAGE}
ExecStartPost=/usr/bin/podman exec configurator /bin/bash -c ' \
ls -1 apps > sites/apps.txt; \
bench set-config -g db_host "db"; \
bench set-config -gp db_port "3306"; \
bench set-config -g redis_cache "redis://redis-cache:6379"; \
bench set-config -g redis_queue "redis://redis-cache:6379"; \
bench set-config -g redis_socketio "redis://redis-cache:6379"; \
bench set-config -gp socketio_port "9000"; \
'
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/configurator.ctr-id -t 10
ExecReload=/usr/bin/podman kill -s HUP configurator
SyslogIdentifier=%u
Expand Down
20 changes: 2 additions & 18 deletions imageroot/systemd/user/create-site.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Podman create-site.service
BindsTo=erp-next.service
After=erp-next.service redis-cache.service db.service configurator.service
After=erp-next.service redis-cache.service db.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Expand All @@ -14,23 +14,7 @@ ExecStart=/usr/bin/podman run --conmon-pidfile %t/create-site.pid \
--pod-id-file %t/erp-next.pod-id --replace -d --name create-site \
-v sites:/home/frappe/frappe-bench/sites \
-v logs:/home/frappe/frappe-bench/logs \
${ERPNEXT_IMAGE} /bin/bash -c 'wait-for-it -t 120 db:3306; \
wait-for-it -t 120 redis-cache:6379; \
wait-for-it -t 120 redis-queue:6379; \
export start=$(date +%s); \
until [[ -n $(grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty") ]] && \
[[ -n $(grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty") ]] && \
[[ -n $(grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty") ]]; \
do \
echo "Waiting for sites/common_site_config.json to be created"; \
sleep 5; \
if [ $(($(date +%s)-start)) -gt 120 ]; then \
echo "could not find sites/common_site_config.json with required keys"; \
exit 1; \
fi; \
done; \
echo "sites/common_site_config.json found"; \
bench new-site --no-mariadb-socket --admin-password=Nethesis1234 --db-root-password=Nethesis1234 --install-app erpnext --set-default frontend;'
${ERPNEXT_IMAGE} bench new-site --no-mariadb-socket --admin-password=Nethesis1234 --db-root-password=Nethesis1234 --install-app erpnext --set-default frontend

ExecStop=/usr/bin/podman stop --ignore --cidfile %t/create-site.ctr-id -t 10
ExecReload=/usr/bin/podman kill -s HUP create-site
Expand Down
4 changes: 2 additions & 2 deletions imageroot/systemd/user/erp-next.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

[Unit]
Description=Podman erp-next.service
Requires=redis-cache.service db.service backend.service configurator.service create-site.service frontend.service queue-long.service queue-short.service websocket.service
Before=redis-cache.service db.service backend.service configurator.service create-site.service frontend.service queue-long.service queue-short.service websocket.service
Requires=redis-cache.service db.service backend.service create-site.service frontend.service queue-long.service queue-short.service websocket.service
Before=redis-cache.service db.service backend.service create-site.service frontend.service queue-long.service queue-short.service websocket.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Expand Down
2 changes: 1 addition & 1 deletion imageroot/systemd/user/frontend.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[Unit]
Description=Podman frontend.service
BindsTo=erp-next.service
After=erp-next.service redis-cache.service db.service backend.service configurator.service create-site.service
After=erp-next.service redis-cache.service db.service backend.service create-site.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Expand Down
2 changes: 1 addition & 1 deletion imageroot/systemd/user/queue-long.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[Unit]
Description=Podman queue-long.service
BindsTo=erp-next.service
After=erp-next.service redis-queue.service redis-cache.service configurator.service
After=erp-next.service redis-queue.service redis-cache.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Expand Down
2 changes: 1 addition & 1 deletion imageroot/systemd/user/queue-short.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[Unit]
Description=Podman queue-short.service
BindsTo=erp-next.service
After=erp-next.service redis-queue.service redis-cache.service configurator.service
After=erp-next.service redis-queue.service redis-cache.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Expand Down

0 comments on commit 147eef9

Please sign in to comment.