Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ct/adventurelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function update_script() {
msg_info "Updating ${APP}"
cp /opt/adventurelog-backup/backend/server/.env /opt/adventurelog/backend/server/.env
cp -r /opt/adventurelog-backup/backend/server/media /opt/adventurelog/backend/server/media
cd /opt/adventurelog/backend/server || exit
cd /opt/adventurelog/backend/server
if [[ ! -x .venv/bin/python ]]; then
$STD uv venv .venv
$STD .venv/bin/python -m ensurepip --upgrade
Expand All @@ -59,7 +59,7 @@ function update_script() {
$STD .venv/bin/python -m manage migrate

cp /opt/adventurelog-backup/frontend/.env /opt/adventurelog/frontend/.env
cd /opt/adventurelog/frontend || exit
cd /opt/adventurelog/frontend
$STD pnpm i
$STD pnpm build
rm -rf /opt/adventurelog-backup
Expand Down
38 changes: 10 additions & 28 deletions install/adventurelog-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,20 @@ msg_ok "Installed Dependencies"
PYTHON_VERSION="3.13" setup_uv
NODE_VERSION="22" NODE_MODULE="pnpm@latest" setup_nodejs
PG_VERSION="17" PG_MODULES="postgis" setup_postgresql

msg_info "Set up PostgreSQL Database"
DB_NAME="adventurelog_db"
DB_USER="adventurelog_user"
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
SECRET_KEY="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)"
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
$STD sudo -u postgres psql -c "CREATE EXTENSION IF NOT EXISTS postgis;" $DB_NAME
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
{
echo "AdventureLog-Credentials"
echo "AdventureLog Database User: $DB_USER"
echo "AdventureLog Database Password: $DB_PASS"
echo "AdventureLog Database Name: $DB_NAME"
echo "AdventureLog Secret: $SECRET_KEY"
} >>~/adventurelog.creds
msg_ok "Set up PostgreSQL"

PG_DB_NAME="adventurelog_db" PG_DB_USER="adventurelog_user" setup_postgresql_db
fetch_and_deploy_gh_release "adventurelog" "seanmorley15/adventurelog"
import_local_ip

msg_info "Installing AdventureLog (Patience)"
SECRET_KEY="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)"
echo "AdventureLog Secret: $SECRET_KEY" >>~/adventurelog.creds
DJANGO_ADMIN_USER="djangoadmin"
DJANGO_ADMIN_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
LOCAL_IP="$(hostname -I | awk '{print $1}')"
cat <<EOF >/opt/adventurelog/backend/server/.env
PGHOST='localhost'
PGDATABASE='${DB_NAME}'
PGUSER='${DB_USER}'
PGPASSWORD='${DB_PASS}'
PGDATABASE='${PG_DB_NAME}'
PGUSER='${PG_DB_USER}'
PGPASSWORD='${PG_DB_PASS}'
SECRET_KEY='${SECRET_KEY}'
PUBLIC_URL='http://$LOCAL_IP:8000'
DEBUG=True
Expand All @@ -74,7 +56,7 @@ DISABLE_REGISTRATION=False
# EMAIL_HOST_PASSWORD='password'
# DEFAULT_FROM_EMAIL='[email protected]'
EOF
cd /opt/adventurelog/backend/server || exit
cd /opt/adventurelog/backend/server
mkdir -p /opt/adventurelog/backend/server/media
$STD uv venv /opt/adventurelog/backend/server/.venv
$STD /opt/adventurelog/backend/server/.venv/bin/python -m ensurepip --upgrade
Expand All @@ -88,13 +70,13 @@ PUBLIC_SERVER_URL=http://$LOCAL_IP:8000
BODY_SIZE_LIMIT=Infinity
ORIGIN='http://$LOCAL_IP:3000'
EOF
cd /opt/adventurelog/frontend || exit
cd /opt/adventurelog/frontend
$STD pnpm i
$STD pnpm build
msg_ok "Installed AdventureLog"

msg_info "Setting up Django Admin"
cd /opt/adventurelog/backend/server || exit
cd /opt/adventurelog/backend/server
$STD .venv/bin/python -m manage shell <<EOF
from django.contrib.auth import get_user_model
UserModel = get_user_model()
Expand Down