Fix paths
This commit is contained in:
parent
80a8beb2df
commit
a405ad9df2
@ -25,19 +25,11 @@ function update_script() {
|
|||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
|
|
||||||
if [[ ! -f /opt/${APP}/start.sh ]]; then
|
if [[ ! -f /opt/wanderer/start.sh ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
INSTALL_DIR="/opt/$APP"
|
|
||||||
SRC_DIR="${INSTALL_DIR}/source"
|
|
||||||
DB_DIR="${SRC_DIR}/db"
|
|
||||||
SEARCH_DIR="${SRC_DIR}/search"
|
|
||||||
WEB_DIR="${SRC_DIR}/web"
|
|
||||||
DATA_DIR="${INSTALL_DIR}/data"
|
|
||||||
PB_DB_LOCATION="${DATA_DIR}/pb_data"
|
|
||||||
MEILI_DB_LOCATION="${DATA_DIR}/meili_data"
|
|
||||||
if check_for_gh_release "$APP" "Flomp/wanderer"; then
|
if check_for_gh_release "$APP" "Flomp/wanderer"; then
|
||||||
|
|
||||||
msg_info "Stopping $APP"
|
msg_info "Stopping $APP"
|
||||||
@ -46,10 +38,10 @@ function update_script() {
|
|||||||
|
|
||||||
|
|
||||||
msg_info "Updating $APP"
|
msg_info "Updating $APP"
|
||||||
$STD fetch_and_deploy_gh_release "$APP" "Flomp/wanderer" "tarball" "latest" "$SRC_DIR"
|
$STD fetch_and_deploy_gh_release "$APP" "Flomp/wanderer" "tarball" "latest" "/opt/wanderer/source"
|
||||||
cd $DB_DIR
|
cd /opt/wanderer/source/db
|
||||||
$STD go mod tidy && $STD go build
|
$STD go mod tidy && $STD go build
|
||||||
cd $WEB_DIR
|
cd /opt/wanderer/source/web
|
||||||
$STD npm ci --omit=dev
|
$STD npm ci --omit=dev
|
||||||
$STD npm run build
|
$STD npm run build
|
||||||
msg_ok "Updated $APP"
|
msg_ok "Updated $APP"
|
||||||
@ -68,8 +60,8 @@ function update_script() {
|
|||||||
|
|
||||||
msg_info "Updating Meilisearch"
|
msg_info "Updating Meilisearch"
|
||||||
|
|
||||||
cd $SEARCH_DIR
|
cd /opt/wanderer/source/search
|
||||||
$STD fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary" "latest" "$SEARCH_DIR"
|
$STD fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary" "latest" "/opt/wanderer/source/search"
|
||||||
msg_ok "Updated Meilisearch"
|
msg_ok "Updated Meilisearch"
|
||||||
|
|
||||||
msg_info "Starting $APP"
|
msg_info "Starting $APP"
|
||||||
|
|||||||
@ -24,33 +24,23 @@ $STD apt-get install --no-install-recommends -y \
|
|||||||
nodejs
|
nodejs
|
||||||
msg_ok "Installded Dependencies"
|
msg_ok "Installded Dependencies"
|
||||||
|
|
||||||
INSTALL_DIR="/opt/${APPLICATION}"
|
mkdir -p "/opt/wanderer"
|
||||||
SRC_DIR="${INSTALL_DIR}/source"
|
mkdir -p "/opt/wanderer/source"
|
||||||
DB_DIR="${SRC_DIR}/db"
|
mkdir -p "/opt/wanderer/data"
|
||||||
SEARCH_DIR="${SRC_DIR}/search"
|
mkdir -p "/opt/wanderer/data/pb_data"
|
||||||
WEB_DIR="${SRC_DIR}/web"
|
mkdir -p "/opt/wanderer/data/meili_data"
|
||||||
DATA_DIR="${INSTALL_DIR}/data"
|
|
||||||
PB_DB_LOCATION="${DATA_DIR}/pb_data"
|
|
||||||
MEILI_DB_LOCATION="${DATA_DIR}/meili_data"
|
|
||||||
|
|
||||||
|
$STD fetch_and_deploy_gh_release "wanderer" "Flomp/wanderer" "tarball" "latest" "/opt/wanderer/source"
|
||||||
mkdir -p "$INSTALL_DIR"
|
|
||||||
mkdir -p "$SRC_DIR"
|
|
||||||
mkdir -p "$DATA_DIR"
|
|
||||||
mkdir -p "$PB_DB_LOCATION"
|
|
||||||
mkdir -p "$MEILI_DB_LOCATION"
|
|
||||||
|
|
||||||
$STD fetch_and_deploy_gh_release "wanderer" "Flomp/wanderer" "tarball" "latest" "$SRC_DIR"
|
|
||||||
|
|
||||||
msg_info "Installing ${APPLICATION} (patience)"
|
msg_info "Installing ${APPLICATION} (patience)"
|
||||||
cd $SEARCH_DIR
|
cd /opt/wanderer/source/search
|
||||||
$STD fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary" "latest" "$SEARCH_DIR"
|
$STD fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary" "latest" "/opt/wanderer/source/search"
|
||||||
$STD meilisearch &
|
$STD meilisearch &
|
||||||
$STD sleep 1
|
$STD sleep 1
|
||||||
$STD kill %%
|
$STD kill %%
|
||||||
cd $DB_DIR
|
cd /opt/wanderer/source/db
|
||||||
$STD go mod tidy && $STD go build
|
$STD go mod tidy && $STD go build
|
||||||
cd $WEB_DIR
|
cd /opt/wanderer/source/web
|
||||||
$STD npm i -s vitest
|
$STD npm i -s vitest
|
||||||
$STD npm ci --omit=dev
|
$STD npm ci --omit=dev
|
||||||
$STD npm run build
|
$STD npm run build
|
||||||
@ -61,7 +51,7 @@ MEILI_KEY=$(openssl rand -hex 32)
|
|||||||
POCKETBASE_KEY=$(openssl rand -hex 16)
|
POCKETBASE_KEY=$(openssl rand -hex 16)
|
||||||
LOCAL_IP="$(hostname -I | awk '{print $1}')"
|
LOCAL_IP="$(hostname -I | awk '{print $1}')"
|
||||||
|
|
||||||
cat <<EOF >"${INSTALL_DIR}"/.env
|
cat <<EOF >/opt/wanderer/.env
|
||||||
ORIGIN=http://${LOCAL_IP}:3000
|
ORIGIN=http://${LOCAL_IP}:3000
|
||||||
MEILI_HTTP_ADDR=${LOCAL_IP}:7700
|
MEILI_HTTP_ADDR=${LOCAL_IP}:7700
|
||||||
MEILI_URL=http://${LOCAL_IP}:7700
|
MEILI_URL=http://${LOCAL_IP}:7700
|
||||||
@ -70,21 +60,21 @@ PB_URL=${LOCAL_IP}:8090
|
|||||||
PUBLIC_POCKETBASE_URL=http://${LOCAL_IP}:8090
|
PUBLIC_POCKETBASE_URL=http://${LOCAL_IP}:8090
|
||||||
PUBLIC_VALHALLA_URL=https://valhalla1.openstreetmap.de
|
PUBLIC_VALHALLA_URL=https://valhalla1.openstreetmap.de
|
||||||
POCKETBASE_ENCRYPTION_KEY=${POCKETBASE_KEY}
|
POCKETBASE_ENCRYPTION_KEY=${POCKETBASE_KEY}
|
||||||
PB_DB_LOCATION=${PB_DB_LOCATION}
|
PB_DB_LOCATION=/opt/wanderer/data/pb_data
|
||||||
MEILI_DB_PATH=${MEILI_DB_LOCATION}
|
MEILI_DB_PATH=/opt/wanderer/data/meili_data
|
||||||
EOF
|
EOF
|
||||||
cat <<EOF >"${INSTALL_DIR}"/start.sh
|
cat <<EOF >/opt/wanderer/start.sh
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
trap "kill 0" EXIT
|
trap "kill 0" EXIT
|
||||||
|
|
||||||
cd ${SEARCH_DIR} && meilisearch --master-key \$MEILI_MASTER_KEY &
|
cd /opt/wanderer/source/search && meilisearch --master-key \$MEILI_MASTER_KEY &
|
||||||
cd ${DB_DIR} && ./pocketbase serve --http=\$PB_URL --dir=\$PB_DB_LOCATION &
|
cd /opt/wanderer/source/db && ./pocketbase serve --http=\$PB_URL --dir=\$PB_DB_LOCATION &
|
||||||
cd ${WEB_DIR} && node build &
|
cd /opt/wanderer/source/web && node build &
|
||||||
|
|
||||||
wait -n
|
wait -n
|
||||||
EOF
|
EOF
|
||||||
chmod +x "${INSTALL_DIR}"/start.sh
|
chmod +x /opt/wanderer/start.sh
|
||||||
cat <<EOF >/etc/systemd/system/"${APPLICATION}"-web.service
|
cat <<EOF >/etc/systemd/system/"${APPLICATION}"-web.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=${APPLICATION}
|
Description=${APPLICATION}
|
||||||
@ -94,8 +84,8 @@ StartLimitBurst=5
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
EnvironmentFile=${INSTALL_DIR}/.env
|
EnvironmentFile=/opt/wanderer/.env
|
||||||
ExecStart=/usr/bin/bash ${INSTALL_DIR}/start.sh
|
ExecStart=/usr/bin/bash /opt/wanderer/start.sh
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=1
|
RestartSec=1
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user