refactor(ci): add dump/copy step to ci deploy pipeline

This commit is contained in:
parent 0183223f32
commit 2f8d5801ef
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -11,7 +11,7 @@ build_stage:
script: script:
# install & build the NuxtJS application # install & build the NuxtJS application
- apt update - apt update
- apt-get install -y --no-install-recommends python3 build-essential #- apt-get install -y --no-install-recommends python3 build-essential
- npm install - npm install
- npm run build - npm run build
# define artifacts which are shared between stages # define artifacts which are shared between stages
@ -31,7 +31,7 @@ deploy_stage:
# install needed packages # install needed packages
# add the SSH key from the variable SSH_DEPLOY_KEY and disable StrictHostKeyChecking # add the SSH key from the variable SSH_DEPLOY_KEY and disable StrictHostKeyChecking
before_script: before_script:
- apt-get update && apt-get install --yes --no-install-recommends rsync git openssh-client curl - apt-get update && apt-get install --yes --no-install-recommends rsync git openssh-client curl sshpass
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- chmod 600 ${SSH_DEPLOY_KEY} - chmod 600 ${SSH_DEPLOY_KEY}
- ssh-add ${SSH_DEPLOY_KEY} - ssh-add ${SSH_DEPLOY_KEY}
@ -45,7 +45,8 @@ deploy_stage:
#- rsync --archive --delete ${CI_PROJECT_DIR}/cnf/ ${DEPLOY_USER}@${DEPLOY_SERVER}:~/cnf/ #- rsync --archive --delete ${CI_PROJECT_DIR}/cnf/ ${DEPLOY_USER}@${DEPLOY_SERVER}:~/cnf/
# restart Node.js and reload nginx configuration # restart Node.js and reload nginx configuration
- ssh rockfic@${DEPLOY_SERVER} 'mongosh mongodb://localhost --eval "use ${DB_NAME}; db.dropDatabase();"' - sshpass -p "${OLDROOTPWD}" ssh root@rockfic.com 'bash ~/cp.sh'
- ssh rockfic@${DEPLOY_SERVER} 'mongosh mongodb://localhost --eval "'"use ${DB_NAME}; db.dropDatabase();"
- ssh rockfic@${DEPLOY_SERVER} 'cd migrator && bun install && bun run ./index.ts' - ssh rockfic@${DEPLOY_SERVER} 'cd migrator && bun install && bun run ./index.ts'
- ssh rockfic@${DEPLOY_SERVER} node run "~/rockfic-staging/.output/server/index.mjs" \&\>/dev/null \& disown \%1 - ssh rockfic@${DEPLOY_SERVER} node run "~/rockfic-staging/.output/server/index.mjs" \&\>/dev/null \& disown \%1
- ssh rockfic@${DEPLOY_SERVER} systemctl reload apache2 - ssh rockfic@${DEPLOY_SERVER} systemctl reload apache2