mirror of https://github.com/tteck/Proxmox
parent
53b24ef7b7
commit
82faca87ad
2 changed files with 173 additions and 0 deletions
@ -0,0 +1,74 @@ |
||||
#!/usr/bin/env bash |
||||
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) |
||||
|
||||
function header_info { |
||||
echo Status |
||||
clear |
||||
} |
||||
header_info |
||||
echo -e "Loading..." |
||||
APP="GlitchTip" |
||||
APP_VERSION="4.0.9" |
||||
var_disk="4" |
||||
var_cpu="2" |
||||
var_ram="1024" |
||||
var_os="debian" |
||||
var_version="12" |
||||
variables |
||||
color |
||||
catch_errors |
||||
|
||||
function default_settings() { |
||||
CT_TYPE="1" |
||||
PW="" |
||||
CT_ID=$NEXTID |
||||
HN=$NSAPP |
||||
DISK_SIZE="$var_disk" |
||||
CORE_COUNT="$var_cpu" |
||||
RAM_SIZE="$var_ram" |
||||
BRG="vmbr0" |
||||
NET="dhcp" |
||||
GATE="" |
||||
APT_CACHER="" |
||||
APT_CACHER_IP="" |
||||
DISABLEIP6="no" |
||||
MTU="" |
||||
SD="" |
||||
NS="" |
||||
MAC="" |
||||
VLAN="" |
||||
SSH="no" |
||||
VERB="no" |
||||
echo_default |
||||
} |
||||
|
||||
function update_script() { |
||||
header_info |
||||
if [[ ! -d /opt/glitchtip ]]; then |
||||
msg_error "No ${APP} Installation Found!" |
||||
exit |
||||
fi |
||||
msg_info "Updating ${APP} LXC" |
||||
rm -rf /opt/glitchtip |
||||
mkdir -p /opt/glitchtip |
||||
wget -O backend.tar.gz https://gitlab.com/glitchtip/glitchtip-backend/-/archive/v${APP_VERSION}/glitchtip-backend-v${APP_VERSION}.tar.gz |
||||
mkdir -p /opt/glitchtip |
||||
tar zxvf backend.tar.gz --strip-components=1 -C /opt/glitchtip |
||||
wget -O assets.zip https://gitlab.com/api/v4/projects/15449363/jobs/artifacts/v${APP_VERSION}/download?job=build-assets |
||||
unzip assets.zip |
||||
mv dist/glitchtip-frontend /opt/glitchtip/dist |
||||
cd /opt/glitchtip |
||||
poetry install --no-root |
||||
source /etc/glitchtip.env |
||||
poetry run ./manage.py migrate |
||||
poetry run ./manage.py collectstatic |
||||
msg_ok "Updated Successfully" |
||||
exit |
||||
} |
||||
|
||||
start |
||||
build_container |
||||
description |
||||
|
||||
echo -e "${APP} should be reachable by going to the following URL. |
||||
${BL}http://${IP}:8000${CL} \n" |
@ -0,0 +1,99 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" |
||||
color |
||||
verb_ip6 |
||||
catch_errors |
||||
setting_up_container |
||||
network_check |
||||
update_os |
||||
|
||||
APP_VERSION=4.0.9 |
||||
|
||||
# https://glitchtip.com/documentation/install#installing-without-docker |
||||
apt-get install -y git |
||||
|
||||
apt-get install -y \ |
||||
python3 \ |
||||
python3-dev \ |
||||
python3-pip \ |
||||
python3-poetry \ |
||||
unzip \ |
||||
celery \ |
||||
redis \ |
||||
postgresql \ |
||||
libpq-dev \ |
||||
sudo |
||||
pip install uwsgi |
||||
|
||||
wget -O backend.tar.gz https://gitlab.com/glitchtip/glitchtip-backend/-/archive/v${APP_VERSION}/glitchtip-backend-v${APP_VERSION}.tar.gz |
||||
mkdir -p /opt/glitchtip |
||||
tar zxvf backend.tar.gz --strip-components=1 -C /opt/glitchtip |
||||
wget -O assets.zip https://gitlab.com/api/v4/projects/15449363/jobs/artifacts/v${APP_VERSION}/download?job=build-assets |
||||
unzip assets.zip |
||||
mv dist/glitchtip-frontend /opt/glitchtip/dist |
||||
cd /opt/glitchtip |
||||
poetry install --no-root |
||||
sudo -u postgres createdb glitchtip |
||||
sudo -u postgres psql glitchtip -c "create user glitchtip password 'glitchtip'" |
||||
sudo -u postgres psql glitchtip -c "grant all privileges on database glitchtip to glitchtip" |
||||
sudo -u postgres psql glitchtip -c "grant all on database glitchtip TO glitchtip" |
||||
sudo -u postgres psql glitchtip -c "grant usage, create on schema public to glitchtip" |
||||
export DATABASE_URL=postgresql://glitchtip:glitchtip@localhost/glitchtip |
||||
poetry run ./manage.py migrate |
||||
poetry run ./manage.py collectstatic |
||||
|
||||
SECRET_KEY=$(openssl rand -hex 32) |
||||
|
||||
# TODO Default EMAIL_URL value? |
||||
|
||||
# EMAIL_URL=consolemail:// |
||||
cat <<EOF >/etc/glitchtip.env |
||||
EMAIL_URL=smtp://:@ntfy:2500 |
||||
DATABASE_URL=$DATABASE_URL |
||||
REDIS_HOST=127.0.0.1 |
||||
SECRET_KEY=$SECRET_KEY |
||||
DEFAULT_FROM_EMAIL=glitchtip@glitchtip.local |
||||
GLITCHTIP_DOMAIN=http://glitchtip |
||||
PORT=8000 |
||||
CELERY_WORKER_AUTOSCALE=1,3 |
||||
CELERY_WORKER_MAX_TASKS_PER_CHILD=10000 |
||||
EOF |
||||
|
||||
cat <<EOF >/etc/systemd/system/glitchtip-worker.service |
||||
[Unit] |
||||
Description=GlitchTip Celery Service |
||||
After=network.target |
||||
[Service] |
||||
WorkingDirectory=/opt/glitchtip |
||||
ExecStart=poetry run /opt/glitchtip/bin/run-celery-with-beat.sh |
||||
EnvironmentFile=/etc/glitchtip.env |
||||
Restart=always |
||||
User=root |
||||
[Install] |
||||
WantedBy=multi-user.target |
||||
EOF |
||||
|
||||
cat <<EOF >/etc/systemd/system/glitchtip.service |
||||
[Unit] |
||||
Description=GlitchTip |
||||
After=network.target |
||||
[Service] |
||||
WorkingDirectory=/opt/glitchtip |
||||
ExecStart=poetry run /opt/glitchtip/bin/start.sh |
||||
EnvironmentFile=/etc/glitchtip.env |
||||
Restart=always |
||||
User=root |
||||
[Install] |
||||
WantedBy=multi-user.target |
||||
EOF |
||||
|
||||
systemctl daemon-reload |
||||
systemctl enable --now glitchtip.service |
||||
systemctl enable --now glitchtip-worker.service |
||||
|
||||
motd_ssh |
||||
customize |
||||
|
||||
apt-get autoremove |
||||
apt-get autoclean |
Loading…
Reference in new issue