build: fix deploy scripts

This commit is contained in:
2024-08-05 20:53:55 +00:00
parent b3a2477d5e
commit f8adef8c48
4 changed files with 15 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ After=network.target
[Service]
WorkingDirectory={{appRoot}}
ExecStart=/usr/local/bin/pnpm start
ExecStart=/root/Library/pnpm/pnpm start
ExecStop=/bin/kill -SIGINT $MAINPID
Restart=on-failure
RestartSec=5

View File

@@ -5,9 +5,8 @@ Requires=docker.service
[Service]
WorkingDirectory={{appRoot}}
Environment="DOCKER_RUN_CMD=docker run --name venom-mongo --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env=GOSU_VERSION=1.17 --env=JSYAML_VERSION=3.13.1 --env=MONGO_PACKAGE=mongodb-org --env=MONGO_REPO=repo.mongodb.org --env=MONGO_MAJOR=7.0 --env=MONGO_VERSION=7.0.12 --env=HOME=/data/db --volume=./{{dbPath}}/db:/data/db --volume=./{{dbPath}}/configdb:/data/configdb --network=bridge -p 27017:27017 --restart=no --label='org.opencontainers.image.ref.name=ubuntu' --label='org.opencontainers.image.version=22.04' --runtime=runc -d mongo:latest"
ExecStart=/bin/bash -c "$DOCKER_RUN_CMD"
ExecStart=/usr/bin/docker run --name venom-mongo --rm --volume={{dbRoot}}/db:/data/db --volume={{dbRoot}}/configdb:/data/configdb mongo:latest
ExecStop=/usr/bin/docker stop venom-mongo
ExecStopPost=/usr/bin/docker rm venom-mongo
Restart=on-failure
@@ -15,3 +14,4 @@ RestartSec=5
[Install]
WantedBy=multi-user.target

View File

@@ -5,8 +5,10 @@
"scripts": {
"start": "tsx src/index.ts",
"dev": "nodemon --exec tsx src/index.ts",
"service": "src/scripts/systemctl.zsh",
"logs": "journalctl -f -n 50 -u venom-bot.service",
"bot": "src/scripts/systemctl.zsh bot",
"db": "src/scripts/systemctl.zsh db",
"logs": "pnpm bot logs",
"dblogs": "pnpm db logs",
"build": "tsc && tsc-alias",
"gen": "simple-scaffold -c scaffold.config.js -k",
"install-services": "src/scripts/install-services.zsh",

View File

@@ -1,8 +1,13 @@
#!/usr/bin/env zsh
if [[ $# -eq 0 ]]; then
echo 'Usage: pnpm service <start|stop|restart|enable|disable>'
if [[ $# -lt 2 ]]; then
echo 'Usage: pnpm service <start|stop|restart|enable|disable|logs>'
return 1
fi
systemctl $1 venom-bot
name=venom-$1
if [[ "$2" == "logs" ]]; then
journalctl -n 30 -f -u $name.service
else
systemctl $2 $name
fi