From b80bb531602bfdda648e08c391fd1844d65318ea Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2026 13:16:28 +0000 Subject: [PATCH] Add journiv (ct) --- ct/headers/journiv | 6 ++ ct/journiv.sh | 69 +++++++++++++++++++ install/journiv-install.sh | 131 +++++++++++++++++++++++++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 ct/headers/journiv create mode 100644 ct/journiv.sh create mode 100644 install/journiv-install.sh diff --git a/ct/headers/journiv b/ct/headers/journiv new file mode 100644 index 000000000..b68f74446 --- /dev/null +++ b/ct/headers/journiv @@ -0,0 +1,6 @@ + __ _ + / /___ __ ___________ (_) __ + __ / / __ \/ / / / ___/ __ \/ / | / / +/ /_/ / /_/ / /_/ / / / / / / /| |/ / +\____/\____/\__,_/_/ /_/ /_/_/ |___/ + diff --git a/ct/journiv.sh b/ct/journiv.sh new file mode 100644 index 000000000..1908875a0 --- /dev/null +++ b/ct/journiv.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/journiv/journiv-app + +APP="Journiv" +var_tags="${var_tags:-journal;notes}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-12}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/journiv ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "journiv" "journiv/journiv-app"; then + msg_info "Stopping Services" + systemctl stop journiv journiv-worker journiv-beat + msg_ok "Stopped Services" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "journiv" "journiv/journiv-app" "tarball" + + msg_info "Updating Python Environment" + cd /opt/journiv + $STD uv sync --locked --no-editable --no-install-project + msg_ok "Updated Python Environment" + + msg_info "Running Database Migrations" + set -a + source /opt/journiv.env + set +a + $STD /opt/journiv/.venv/bin/python -c "from alembic.config import main; main(['upgrade', 'head'])" + msg_ok "Ran Database Migrations" + + msg_info "Starting Services" + systemctl start journiv journiv-worker journiv-beat + msg_ok "Started Services" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW}Access it using the following URL:${CL}" +echo -e "${GATEWAY}${BGN}http://${IP}:8000${CL}" diff --git a/install/journiv-install.sh b/install/journiv-install.sh new file mode 100644 index 000000000..664a60930 --- /dev/null +++ b/install/journiv-install.sh @@ -0,0 +1,131 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/journiv/journiv-app + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y \ + build-essential \ + libffi-dev \ + libpq-dev \ + libmagic1 \ + libheif1 \ + libde265-0 \ + libpango-1.0-0 \ + libpangoft2-1.0-0 \ + redis-server +systemctl enable -q --now redis-server +msg_ok "Installed Dependencies" + +setup_ffmpeg +PG_VERSION="17" setup_postgresql +PG_DB_NAME="journiv" PG_DB_USER="journiv" setup_postgresql_db +UV_PYTHON="3.12" setup_uv + +fetch_and_deploy_gh_release "journiv" "journiv/journiv-app" "tarball" + +msg_info "Setting up Python Environment" +cd /opt/journiv +$STD uv sync --locked --no-editable --no-install-project +msg_ok "Set up Python Environment" + +msg_info "Configuring Journiv" +mkdir -p /opt/journiv_data/{media,logs,exports,imports/temp} +cat </opt/journiv.env +ENVIRONMENT=production +SECRET_KEY=$(openssl rand -hex 32) +DB_DRIVER=postgres +DATABASE_URL=postgresql://journiv:${PG_DB_PASS}@localhost:5432/journiv +REDIS_URL=redis://127.0.0.1:6379/0 +MEDIA_ROOT=/opt/journiv_data/media +LOG_DIR=/opt/journiv_data/logs +EXPORT_DIR=/opt/journiv_data/exports +IMPORT_TEMP_DIR=/opt/journiv_data/imports/temp +DOMAIN_NAME=${LOCAL_IP} +DOMAIN_SCHEME=http +PYTHONPATH=/opt/journiv +EOF +chmod 600 /opt/journiv.env +msg_ok "Configured Journiv" + +msg_info "Initializing Database" +set -a +source /opt/journiv.env +set +a +$STD /opt/journiv/.venv/bin/python -c "from alembic.config import main; main(['upgrade', 'head'])" +SKIP_DATA_SEEDING=false $STD /opt/journiv/.venv/bin/python -c "from app.core.database import seed_initial_data; seed_initial_data()" +msg_ok "Initialized Database" + +msg_info "Creating Services" +cat </etc/systemd/system/journiv.service +[Unit] +Description=Journiv +Wants=network-online.target +After=network-online.target postgresql.service redis-server.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/journiv +EnvironmentFile=/opt/journiv.env +ExecStart=/opt/journiv/.venv/bin/python -m gunicorn app.main:app -w 2 -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:8000 +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF + +cat </etc/systemd/system/journiv-worker.service +[Unit] +Description=Journiv Celery Worker +Wants=network-online.target +After=network-online.target journiv.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/journiv +EnvironmentFile=/opt/journiv.env +ExecStart=/opt/journiv/.venv/bin/python -m celery -A app.core.celery_app worker --loglevel=info +Restart=on-failure +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF + +cat </etc/systemd/system/journiv-beat.service +[Unit] +Description=Journiv Celery Beat +Wants=network-online.target +After=network-online.target journiv.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/journiv +EnvironmentFile=/opt/journiv.env +ExecStart=/opt/journiv/.venv/bin/python -m celery -A app.core.celery_app beat --loglevel=info --scheduler redbeat.RedBeatScheduler --pidfile=/run/journiv-beat.pid +Restart=on-failure +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now journiv journiv-worker journiv-beat +msg_ok "Created Services" + +motd_ssh +customize +cleanup_lxc