decidim: mirror koopa-decidim setup (9027, docs for /sm showcase)
This commit is contained in:
parent
d519fb3c80
commit
9ae0dfa429
21 changed files with 998 additions and 2 deletions
22
configs/decidim/bin/apply-branding.sh
Executable file
22
configs/decidim/bin/apply-branding.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
# Apply hacktivism colors + header CSS on the live organization.
|
||||
set -euo pipefail
|
||||
cd "${HOME}/koopa-decidim"
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
source .env
|
||||
# shellcheck disable=SC1091
|
||||
source users.env
|
||||
set +a
|
||||
podman exec \
|
||||
-e DECIDIM_HOST="${DECIDIM_HOST:-decidim.hacktivism.ch}" \
|
||||
-e DECIDIM_SYSTEM_EMAIL \
|
||||
-e DECIDIM_SYSTEM_PASSWORD \
|
||||
-e DECIDIM_ADMIN_EMAIL \
|
||||
-e DECIDIM_ADMIN_PASSWORD \
|
||||
-e DECIDIM_ADMIN_NAME \
|
||||
-e DECIDIM_APPLICATION_NAME \
|
||||
-e DECIDIM_DEFAULT_LOCALE \
|
||||
-e DECIDIM_AVAILABLE_LOCALES \
|
||||
koopa-decidim bundle exec rails runner /code/lib/koopa_bootstrap.rb
|
||||
echo "branding applied. public: https://decidim.hacktivism.ch/"
|
||||
38
configs/decidim/bin/install-systemd.sh
Executable file
38
configs/decidim/bin/install-systemd.sh
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env bash
|
||||
# Install Decidim user systemd units on koopa (boot via linger).
|
||||
set -euo pipefail
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
LIVE="${HOME}/koopa-decidim"
|
||||
# admin-log tree (scripts/decidim → ../..) or live ~/koopa-decidim/bin
|
||||
if [ -f "${HERE}/../../configs/decidim/container-koopa-decidim.service" ]; then
|
||||
UNIT_SRC="${HERE}/../../configs/decidim"
|
||||
elif [ -f "${LIVE}/container-koopa-decidim.service" ]; then
|
||||
UNIT_SRC="${LIVE}"
|
||||
else
|
||||
echo "ERROR: decidim unit files not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
UNIT_DIR="${HOME}/.config/systemd/user"
|
||||
|
||||
mkdir -p "${UNIT_DIR}"
|
||||
cp "${UNIT_SRC}/container-koopa-decidim-db.service" "${UNIT_DIR}/"
|
||||
cp "${UNIT_SRC}/container-koopa-decidim.service" "${UNIT_DIR}/"
|
||||
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable \
|
||||
container-koopa-decidim-db.service \
|
||||
container-koopa-decidim.service
|
||||
|
||||
if ! podman ps --format '{{.Names}}' | grep -qx koopa-decidim; then
|
||||
(cd "${HOME}/koopa-decidim" && set -a && source .env && set +a && podman-compose up -d)
|
||||
fi
|
||||
|
||||
systemctl --user start \
|
||||
container-koopa-decidim-db.service \
|
||||
container-koopa-decidim.service
|
||||
|
||||
systemctl --user --no-pager --lines=0 status \
|
||||
container-koopa-decidim-db.service \
|
||||
container-koopa-decidim.service || true
|
||||
|
||||
echo "OK. Public: https://decidim.hacktivism.ch/"
|
||||
39
configs/decidim/bin/seed-example.sh
Executable file
39
configs/decidim/bin/seed-example.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
# Publish public example process/meeting + optional isoc user from users.env.
|
||||
set -euo pipefail
|
||||
cd "${HOME}/koopa-decidim"
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
source .env
|
||||
# shellcheck disable=SC1091
|
||||
source users.env
|
||||
set +a
|
||||
|
||||
src=""
|
||||
if [ -f "${HOME}/src/koopa/koopa-admin-log/configs/decidim/seed_example.rb" ]; then
|
||||
src="${HOME}/src/koopa/koopa-admin-log/configs/decidim/seed_example.rb"
|
||||
elif [ -f ./seed_example.rb ]; then
|
||||
src="./seed_example.rb"
|
||||
else
|
||||
echo "ERROR: seed_example.rb not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
podman cp "${src}" koopa-decidim:/code/lib/koopa_seed_example.rb
|
||||
|
||||
avatar_host="${DECIDIM_ISOC_AVATAR:-${HOME}/koopa-decidim/assets/img/isoc-gold.png}"
|
||||
avatar_ctr=""
|
||||
if [ -f "${avatar_host}" ]; then
|
||||
avatar_ctr="/tmp/isoc-gold.png"
|
||||
podman cp "${avatar_host}" "koopa-decidim:${avatar_ctr}"
|
||||
fi
|
||||
|
||||
podman exec \
|
||||
-e DECIDIM_HOST="${DECIDIM_HOST:-decidim.hacktivism.ch}" \
|
||||
-e DECIDIM_ADMIN_EMAIL \
|
||||
-e DECIDIM_ISOC_EMAIL \
|
||||
-e DECIDIM_ISOC_PASSWORD \
|
||||
-e DECIDIM_ISOC_NAME \
|
||||
-e DECIDIM_ISOC_NICKNAME \
|
||||
-e DECIDIM_ISOC_AVATAR="${avatar_ctr}" \
|
||||
koopa-decidim bundle exec rails runner /code/lib/koopa_seed_example.rb
|
||||
echo "seed done. public: https://decidim.hacktivism.ch/processes/example"
|
||||
21
configs/decidim/bin/up.sh
Executable file
21
configs/decidim/bin/up.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
DIR="${HOME}/koopa-decidim"
|
||||
cd "${DIR}"
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
source .env
|
||||
set +a
|
||||
podman-compose up -d
|
||||
echo "== wait for :9027 =="
|
||||
ok=0
|
||||
for i in $(seq 1 80); do
|
||||
code=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 5 "http://127.0.0.1:9027/" || true)
|
||||
echo "try $i: $code"
|
||||
case "$code" in
|
||||
2*|3*) ok=1; break ;;
|
||||
esac
|
||||
sleep 5
|
||||
done
|
||||
[[ "$ok" -eq 1 ]] || { echo "ERROR: no answer on 9027"; podman-compose ps; exit 1; }
|
||||
echo "local ok. public: https://decidim.hacktivism.ch/"
|
||||
Loading…
Add table
Add a link
Reference in a new issue