Browse Source

feat(drone): enhance deployment configuration with additional environment variables and PM2 commands

- Added new environment variables in .drone.yml for database and media management, improving security and flexibility during deployment.
- Included PM2 commands to manage the application lifecycle, ensuring proper start, stop, and delete operations for the nuxt4-demo application.
- Updated package.json to streamline the database copy command by removing unnecessary file operations.

These changes enhance the deployment process by improving environment management and application control.
main
npmrun 1 week ago
parent
commit
420122f85f
  1. 19
      .drone.yml
  2. 2
      package.json

19
.drone.yml

@ -21,6 +21,20 @@ steps:
UNZIP_DIR: /root/projects/nuxt4-demo/nuxt4-demo UNZIP_DIR: /root/projects/nuxt4-demo/nuxt4-demo
DEPLOY_SSH_KEY: DEPLOY_SSH_KEY:
from_secret: DEPLOY_SSH_KEY from_secret: DEPLOY_SSH_KEY
DATABASE_URL:
from_secret: DATABASE_URL
NITRO_PORT:
from_secret: NITRO_PORT
STATIC_DIR:
from_secret: STATIC_DIR
TMP_DIR:
from_secret: TMP_DIR
MEDIA_UPLOAD_SUBDIR:
from_secret: MEDIA_UPLOAD_SUBDIR
BOOTSTRAP_ADMIN_USERNAME:
from_secret: BOOTSTRAP_ADMIN_USERNAME
BOOTSTRAP_ADMIN_PASSWORD:
from_secret: BOOTSTRAP_ADMIN_PASSWORD
commands: commands:
- mkdir -p -m 700 "/root/.ssh" - mkdir -p -m 700 "/root/.ssh"
- umask 077 && printf '%s\n' "$DEPLOY_SSH_KEY" > "/root/.ssh/id_rsa" - umask 077 && printf '%s\n' "$DEPLOY_SSH_KEY" > "/root/.ssh/id_rsa"
@ -50,4 +64,7 @@ steps:
[ -f "$REPO_DIR/build-output.tar.gz" ] || { echo "build-output.tar.gz not found in $REPO_DIR"; exit 1; } [ -f "$REPO_DIR/build-output.tar.gz" ] || { echo "build-output.tar.gz not found in $REPO_DIR"; exit 1; }
rm -rf "$UNZIP_DIR" rm -rf "$UNZIP_DIR"
mkdir -p "$UNZIP_DIR" mkdir -p "$UNZIP_DIR"
tar -xzf "$REPO_DIR/build-output.tar.gz" -C "$UNZIP_DIR" tar -xzf "$REPO_DIR/build-output.tar.gz" -C "$UNZIP_DIR"
- 'bash -lc "cd $UNZIP_DIR && pm2 stop nuxt4-demo || true"'
- 'bash -lc "cd $UNZIP_DIR && pm2 delete nuxt4-demo || true"'
- 'bash -lc "cd $UNZIP_DIR && pm2 start ./run.sh --name nuxt4-demo"'

2
package.json

@ -11,7 +11,7 @@
"dev": "bun run sync:vditor && nuxt dev", "dev": "bun run sync:vditor && nuxt dev",
"deploy": "sh scripts/deploy-gitea.sh", "deploy": "sh scripts/deploy-gitea.sh",
"sync:vditor": "sh scripts/sync-vditor-assets.sh", "sync:vditor": "sh scripts/sync-vditor-assets.sh",
"cp:db": "cp build-files/run.sh .output/run.sh && cp build-files/.drone.yml .output/.drone.yml && sh scripts/mv-env.sh && cp -r build-files/migrate/* .output/server/ && cp build-files/seed.js .output/server/seed.js", "cp:db": "cp build-files/run.sh .output/run.sh && cp -r build-files/migrate/* .output/server/ && cp build-files/seed.js .output/server/seed.js",
"migrate:test": "sh scripts/migrate-test.sh", "migrate:test": "sh scripts/migrate-test.sh",
"db:migrate": "bun --elide-lines=0 --filter drizzle-pkg migrate", "db:migrate": "bun --elide-lines=0 --filter drizzle-pkg migrate",
"db:generate": "bun --elide-lines=0 --filter drizzle-pkg generate", "db:generate": "bun --elide-lines=0 --filter drizzle-pkg generate",

Loading…
Cancel
Save