cleanup
This commit is contained in:
parent
b0c436dd42
commit
2d0b42ae45
@ -1,75 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: lucasfell
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://ghostfol.io/
|
||||
|
||||
APP="Ghostfolio"
|
||||
var_tags="${var_tags:-finance;investment}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-4096}"
|
||||
var_disk="${var_disk:-8}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /opt/ghostfolio/dist/apps/api/main.js ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "ghostfolio" "ghostfolio/ghostfolio"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop ghostfolio
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Creating Backup"
|
||||
tar -czf "/opt/ghostfolio_backup_$(date +%F).tar.gz" \
|
||||
-C /opt \
|
||||
--exclude="ghostfolio/node_modules" \
|
||||
--exclude="ghostfolio/dist" \
|
||||
ghostfolio
|
||||
mv /opt/ghostfolio/.env /opt/env.backup
|
||||
msg_ok "Backup Created"
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio"
|
||||
|
||||
msg_info "Updating Ghostfolio"
|
||||
mv /opt/env.backup /opt/ghostfolio/.env
|
||||
cd /opt/ghostfolio
|
||||
$STD npm ci
|
||||
$STD npm run build:production
|
||||
$STD npx prisma migrate deploy
|
||||
msg_ok "Updated Ghostfolio"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start ghostfolio
|
||||
msg_ok "Started Service"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
$STD npm cache clean --force
|
||||
msg_ok "Cleanup Completed"
|
||||
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 "${TAB}${GATEWAY}${BGN}http://${IP}:3333${CL}"
|
55
ct/myip.sh
55
ct/myip.sh
@ -1,55 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Slaviša Arežina (tremor021)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://ipcheck.ing/
|
||||
|
||||
APP="MyIP"
|
||||
var_tags="${var_tags:-network}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-512}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
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/myip ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "myip" "jason5ng32/MyIP"; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop myip
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
cp /opt/myip/.env /opt
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "myip" "jason5ng32/MyIP" "tarball"
|
||||
mv /opt/.env /opt/myip
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start myip
|
||||
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 "${TAB}${GATEWAY}${BGN}http://${IP}:18966${CL}"
|
@ -1,63 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: BvdBerg01
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/sassanix/Warracker/
|
||||
|
||||
APP="warracker"
|
||||
var_tags="${var_tags:-warranty}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-512}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
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/warracker ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "warracker" "sassanix/Warracker"; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop warrackermigration
|
||||
systemctl stop warracker
|
||||
systemctl stop nginx
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
fetch_and_deploy_gh_release "warracker" "sassanix/Warracker" "tarball" "latest" "/opt/warracker"
|
||||
|
||||
msg_info "Updating Warracker"
|
||||
cd /opt/warracker/backend
|
||||
$STD uv venv .venv
|
||||
$STD source .venv/bin/activate
|
||||
$STD uv pip install -r requirements.txt
|
||||
msg_ok "Updated Warracker"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start warracker
|
||||
systemctl start nginx
|
||||
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 "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
@ -1,56 +0,0 @@
|
||||
{
|
||||
"name": "Ghostfolio",
|
||||
"slug": "ghostfolio",
|
||||
"categories": [
|
||||
23
|
||||
],
|
||||
"date_created": "2025-08-14",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 3333,
|
||||
"documentation": "https://github.com/ghostfolio/ghostfolio?tab=readme-ov-file#self-hosting",
|
||||
"website": "https://ghostfol.io/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/ghostfolio.webp",
|
||||
"config_path": "/opt/ghostfolio/.env",
|
||||
"description": "Ghostfolio is an open source wealth management software built with web technology. The application empowers busy people to keep track of stocks, ETFs or cryptocurrencies and make solid, data-driven investment decisions.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/ghostfolio.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 4096,
|
||||
"hdd": 8,
|
||||
"os": "debian",
|
||||
"version": "12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "Create your first user account by visiting the web interface and clicking 'Get Started'. The first user will automatically get admin privileges.",
|
||||
"type": "info"
|
||||
},
|
||||
{
|
||||
"text": "Database and Redis credentials: `cat ~/ghostfolio.creds`",
|
||||
"type": "info"
|
||||
},
|
||||
{
|
||||
"text": "Configuration file: `/opt/ghostfolio/.env`",
|
||||
"type": "info"
|
||||
},
|
||||
{
|
||||
"text": "Optional: CoinGecko API keys can be added during installation or later in the .env file for enhanced cryptocurrency data.",
|
||||
"type": "info"
|
||||
},
|
||||
{
|
||||
"text": "Build process requires 4GB RAM (runtime: ~2GB). A temporary swap file will be created automatically if insufficient memory is detected.",
|
||||
"type": "warning"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
{
|
||||
"name": "MyIP",
|
||||
"slug": "myip",
|
||||
"categories": [
|
||||
4
|
||||
],
|
||||
"date_created": "2025-07-02",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"config_path": "/opt/myip/.env",
|
||||
"interface_port": 18966,
|
||||
"documentation": "https://github.com/jason5ng32/MyIP#-environment-variable",
|
||||
"website": "https://ipcheck.ing/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/myip.webp",
|
||||
"description": "The best IP Toolbox. Easy to check what's your IPs, IP geolocation, check for DNS leaks, examine WebRTC connections, speed test, ping test, MTR test, check website availability, whois search and more!",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/myip.sh",
|
||||
"resources": {
|
||||
"cpu": 1,
|
||||
"ram": 512,
|
||||
"hdd": 2,
|
||||
"os": "Debian",
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": []
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
{
|
||||
"name": "Warracker",
|
||||
"slug": "warracker",
|
||||
"categories": [
|
||||
12
|
||||
],
|
||||
"date_created": "2025-09-19",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 80,
|
||||
"documentation": null,
|
||||
"config_path": "/opt/.env",
|
||||
"website": "https://warracker.com/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/warracker.webp",
|
||||
"description": "Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/warracker.sh",
|
||||
"resources": {
|
||||
"cpu": 1,
|
||||
"ram": 512,
|
||||
"hdd": 4,
|
||||
"os": "Debian",
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "The first user you register will be the admin user.",
|
||||
"type": "info"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: lucasfell
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://ghostfol.io/
|
||||
|
||||
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 \
|
||||
openssl \
|
||||
ca-certificates \
|
||||
redis-server
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PG_VERSION="17" setup_postgresql
|
||||
NODE_VERSION="24" setup_nodejs
|
||||
|
||||
msg_info "Setting up Database"
|
||||
DB_NAME=ghostfolio
|
||||
DB_USER=ghostfolio
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
REDIS_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
ACCESS_TOKEN_SALT=$(openssl rand -base64 32)
|
||||
JWT_SECRET_KEY=$(openssl rand -base64 32)
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;"
|
||||
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH ENCRYPTED PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -c "ALTER USER $DB_USER CREATEDB;"
|
||||
$STD sudo -u postgres psql -d $DB_NAME -c "GRANT ALL ON SCHEMA public TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -d $DB_NAME -c "GRANT CREATE ON SCHEMA public TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO $DB_USER;"
|
||||
{
|
||||
echo "Ghostfolio Credentials"
|
||||
echo "Database User: $DB_USER"
|
||||
echo "Database Password: $DB_PASS"
|
||||
echo "Database Name: $DB_NAME"
|
||||
echo "Redis Password: $REDIS_PASS"
|
||||
echo "Access Token Salt: $ACCESS_TOKEN_SALT"
|
||||
echo "JWT Secret Key: $JWT_SECRET_KEY"
|
||||
} >>~/ghostfolio.creds
|
||||
msg_ok "Set up Database"
|
||||
|
||||
fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio"
|
||||
|
||||
msg_info "Setup Ghostfolio"
|
||||
sed -i "s/# requirepass foobared/requirepass $REDIS_PASS/" /etc/redis/redis.conf
|
||||
systemctl restart redis-server
|
||||
cd /opt/ghostfolio
|
||||
$STD npm ci
|
||||
$STD npm run build:production
|
||||
msg_ok "Built Ghostfolio"
|
||||
|
||||
msg_ok "Optional CoinGecko API Configuration"
|
||||
echo
|
||||
echo -e "${YW}CoinGecko API keys are optional but provide better cryptocurrency data.${CL}"
|
||||
echo -e "${YW}You can skip this and add them later by editing /opt/ghostfolio/.env${CL}"
|
||||
echo
|
||||
read -rp "${TAB3}CoinGecko Demo API key (press Enter to skip): " COINGECKO_DEMO_KEY
|
||||
read -rp "${TAB3}CoinGecko Pro API key (press Enter to skip): " COINGECKO_PRO_KEY
|
||||
|
||||
msg_info "Setting up Environment"
|
||||
cat <<EOF >/opt/ghostfolio/.env
|
||||
DATABASE_URL=postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME?connect_timeout=300&sslmode=prefer
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=$REDIS_PASS
|
||||
ACCESS_TOKEN_SALT=$ACCESS_TOKEN_SALT
|
||||
JWT_SECRET_KEY=$JWT_SECRET_KEY
|
||||
NODE_ENV=production
|
||||
PORT=3333
|
||||
HOST=0.0.0.0
|
||||
EOF
|
||||
|
||||
if [[ -n "${COINGECKO_DEMO_KEY:-}" ]]; then
|
||||
echo "API_KEY_COINGECKO_DEMO=$COINGECKO_DEMO_KEY" >>/opt/ghostfolio/.env
|
||||
fi
|
||||
|
||||
if [[ -n "${COINGECKO_PRO_KEY:-}" ]]; then
|
||||
echo "API_KEY_COINGECKO_PRO=$COINGECKO_PRO_KEY" >>/opt/ghostfolio/.env
|
||||
fi
|
||||
msg_ok "Set up Environment"
|
||||
|
||||
msg_info "Running Database Migrations"
|
||||
cd /opt/ghostfolio
|
||||
$STD npx prisma migrate deploy
|
||||
$STD npx prisma db seed
|
||||
msg_ok "Database Migrations Complete"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/ghostfolio.service
|
||||
[Unit]
|
||||
Description=Ghostfolio Investment Tracker
|
||||
After=network.target postgresql.service redis-server.service
|
||||
Wants=postgresql.service redis-server.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/ghostfolio/dist/apps/api
|
||||
Environment=NODE_ENV=production
|
||||
EnvironmentFile=/opt/ghostfolio/.env
|
||||
ExecStart=/usr/bin/node main.js
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl enable -q --now ghostfolio
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD npm cache clean --force
|
||||
$STD apt -y autoremove
|
||||
$STD apt -y autoclean
|
||||
$STD apt -y clean
|
||||
msg_ok "Cleaned"
|
@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Slaviša Arežina (tremor021)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://ipcheck.ing/
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
fetch_and_deploy_gh_release "myip" "jason5ng32/MyIP" "tarball"
|
||||
|
||||
msg_info "Configuring MyIP"
|
||||
cd /opt/myip
|
||||
cp .env.example .env
|
||||
$STD npm install
|
||||
$STD npm run build
|
||||
msg_ok "Configured MyIP"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/myip.service
|
||||
[Unit]
|
||||
Description=MyIP Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/myip
|
||||
ExecStart=/usr/bin/npm start
|
||||
EnvironmentFile=/opt/myip/.env
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now myip
|
||||
msg_ok "Service created"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt -y autoremove
|
||||
$STD apt -y autoclean
|
||||
$STD apt -y clean
|
||||
msg_ok "Cleaned"
|
@ -1,119 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: bvdberg01
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://github.com/sassanix/Warracker/
|
||||
|
||||
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 \
|
||||
libpq-dev \
|
||||
nginx
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PYTHON_VERSION="3.13" setup_uv
|
||||
PG_VERSION="17" setup_postgresql
|
||||
|
||||
msg_info "Setup PostgreSQL"
|
||||
DB_NAME="warranty_db"
|
||||
DB_USER="warranty_user"
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||
DB_ADMIN_USER="warracker_admin"
|
||||
DB_ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE USER $DB_ADMIN_USER WITH PASSWORD '$DB_ADMIN_PASS' SUPERUSER;"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME OWNER $DB_ADMIN_USER;"
|
||||
$STD sudo -u postgres psql -d "$DB_NAME" -c "GRANT USAGE ON SCHEMA public TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -d "$DB_NAME" -c "GRANT CREATE ON SCHEMA public TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -d "$DB_NAME" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO $DB_USER;"
|
||||
{
|
||||
echo "Application Credentials"
|
||||
echo "DB_NAME: $DB_NAME"
|
||||
echo "DB_USER: $DB_USER"
|
||||
echo "DB_PASS: $DB_PASS"
|
||||
echo "DB_ADMIN_USER: $DB_ADMIN_USER"
|
||||
echo "DB_ADMIN_PASS: $DB_ADMIN_PASS"
|
||||
} >>~/warracker.creds
|
||||
msg_ok "Setup PostgreSQL"
|
||||
|
||||
fetch_and_deploy_gh_release "warracker" "sassanix/Warracker" "tarball" "latest" "/opt/warracker"
|
||||
|
||||
msg_info "Installing Warracker"
|
||||
cd /opt/warracker/backend
|
||||
$STD uv venv .venv
|
||||
$STD source .venv/bin/activate
|
||||
$STD uv pip install -r requirements.txt
|
||||
mv /opt/warracker/env.example /opt/.env
|
||||
sed -i \
|
||||
-e "s/your_secure_database_password/$DB_PASS/" \
|
||||
-e "s/your_secure_admin_password/$DB_ADMIN_PASS/" \
|
||||
-e "s|^# DB_PORT=5432$|DB_HOST=127.0.0.1|" \
|
||||
-e "s|your_very_secure_flask_secret_key_change_this_in_production|$(openssl rand -base64 32 | tr -d '\n')|" \
|
||||
/opt/.env
|
||||
mkdir -p /data/uploads
|
||||
msg_ok "Installed Warracker"
|
||||
|
||||
msg_info "Configuring Nginx"
|
||||
mv /opt/warracker/nginx.conf /etc/nginx/sites-available/warracker.conf
|
||||
sed -i \
|
||||
-e "s|alias /var/www/html/locales/;|alias /opt/warracker/locales/;|" \
|
||||
-e "s|/var/www/html|/opt/warracker/frontend|g" \
|
||||
-e "s/client_max_body_size __NGINX_MAX_BODY_SIZE_CONFIG_VALUE__/client_max_body_size 32M/" \
|
||||
/etc/nginx/sites-available/warracker.conf
|
||||
ln -s /etc/nginx/sites-available/warracker.conf /etc/nginx/sites-enabled/warracker.conf
|
||||
rm /etc/nginx/sites-enabled/default
|
||||
systemctl restart nginx
|
||||
|
||||
msg_ok "Configured Nginx"
|
||||
|
||||
msg_info "Creating systemd services"
|
||||
cat <<EOF >/etc/systemd/system/warrackermigration.service
|
||||
[Unit]
|
||||
Description=Warracker Migration Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
WorkingDirectory=/opt/warracker/backend/migrations
|
||||
EnvironmentFile=/opt/.env
|
||||
ExecStart=/opt/warracker/backend/.venv/bin/python apply_migrations.py
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/warracker.service
|
||||
[Unit]
|
||||
Description=Warracker Service
|
||||
After=network.target warrackermigration.service
|
||||
Requires=warrackermigration.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/warracker
|
||||
EnvironmentFile=/opt/.env
|
||||
ExecStart=/opt/warracker/backend/.venv/bin/gunicorn --config /opt/warracker/backend/gunicorn_config.py backend:create_app() --bind 127.0.0.1:5000
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now warracker
|
||||
msg_ok "Started Warracker Services"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt -y autoremove
|
||||
$STD apt -y autoclean
|
||||
$STD apt -y clean
|
||||
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user