fix(ci): canary bun

fix(ci): add .output segment to bun run path

fix(ci): pass `-y` to apt install

fix(ci): change directory

fix(ci): update apt

fix(ci): remove sudo

fix(ci): use debian bun

fix(ci): use debian bun

fix(ci): disown bun process

refactor(ci): switch to bun

fix(ci): watch

fix(ci): unquote tilde string

fix(ci): pipe cat output

fix(ci): wrap tildes in ssh command in quotes

fix(ci): chmod private key file

fix(ci): fix environment

refactor(ci): update ci file

both stages should work now
This commit is contained in:
parent ae95cca2e6
commit a28a89f2a9
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -7,16 +7,17 @@ stages:
build_stage: build_stage:
stage: build stage: build
# use node docker image as enviroment # use node docker image as enviroment
image: node:latest image: oven/bun:debian
script: script:
# install & build the NuxtJS application # install & build the NuxtJS application
- npm install - apt update
- npm run build - apt-get install -y --no-install-recommends python3 build-essential
- bun install
- bun run --bun build
# define artifacts which are shared between stages # define artifacts which are shared between stages
artifacts: artifacts:
paths: paths:
- .nuxt/ - .output/
- node_modules/
# restrict to specific branch # restrict to specific branch
only: only:
@ -32,19 +33,25 @@ deploy_stage:
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
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- ssh-add <(echo "${SSH_DEPLOY_KEY}") - chmod 600 ${SSH_DEPLOY_KEY}
- ssh-add ${SSH_DEPLOY_KEY}
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script: script:
# deploy application and server configuration # deploy application and server configuration
- rsync --archive --delete ${CI_PROJECT_DIR}/ ${DEPLOY_USER}@${DEPLOY_SERVER}:~/opsone-demo/ - cat ${ENV_FILE} | ssh rockfic@${DEPLOY_SERVER} 'cat > rockfic-staging/.env'
- rsync --archive --delete ${CI_PROJECT_DIR}/cnf/ ${DEPLOY_USER}@${DEPLOY_SERVER}:~/cnf/ - rsync --archive --delete ${CI_PROJECT_DIR}/ rockfic@${DEPLOY_SERVER}:~/rockfic-staging/
#- 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 ${DEPLOY_USER}@${DEPLOY_SERVER} nodejs-restart - ssh rockfic@${DEPLOY_SERVER} 'mongosh mongodb://localhost --eval "use ${DB_NAME}; db.dropDatabase();"'
- ssh ${DEPLOY_USER}@${DEPLOY_SERVER} nginx-reload - ssh rockfic@${DEPLOY_SERVER} 'cd migrator && bun install && bun run ./index.ts'
- ssh rockfic@${DEPLOY_SERVER} bun --watch run "~/rockfic-staging/.output/server/index.mjs" \&\>/dev/null \& disown \%1
- ssh rockfic@${DEPLOY_SERVER} systemctl reload apache2
environment:
name: staging
url: https://next.rockfic.com
# restrict to specific branch # restrict to specific branch
only: only:
- master - master