Migrate to sveltekit #26
2 changed files with 45 additions and 15 deletions
|
@ -18,23 +18,19 @@ jobs:
|
|||
with:
|
||||
node-version: 19
|
||||
|
||||
- name: Install rsync
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y rsync
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{secrets.SSH_KEY}}
|
||||
SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Build app
|
||||
run: npm run build
|
||||
- name: Install PM2
|
||||
run: npm i -g pm2
|
||||
|
||||
- name: Add Deploy Key to SSH
|
||||
run: |
|
||||
mkdir ~/.ssh
|
||||
echo "${{ secrets.SSH_KEY }}" >> ~/.ssh/id_ed25519_embroideryviewer
|
||||
chmod 400 ~/.ssh/id_ed25519_embroideryviewer
|
||||
echo -e "Host embroideryviewer\n\tUser embroideryviewer\n\tHostname 45.76.5.44\n\tIdentityFile ~/.ssh/id_ed25519_embroideryviewer\n\tStrictHostKeyChecking No" >> ~/.ssh/config
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_KEY }}" >> ./deploy.key
|
||||
sudo chmod 600 ./deploy.key
|
||||
echo "${{ secrets.SSH_KNOWN_HOSTS}}" > ~/.ssh/known_hosts
|
||||
|
||||
- name: Upload changes to server
|
||||
run: rsync -avz --progress dist/ embroideryviewer:web/prod
|
||||
- name: Deploy
|
||||
run: env $(cat .env | grep -v \"#\" | xargs) pm2 deploy ecosystem.config.cjs production
|
||||
|
|
34
ecosystem.config.cjs
Normal file
34
ecosystem.config.cjs
Normal file
|
@ -0,0 +1,34 @@
|
|||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'embroidery-viewer',
|
||||
script: './build/index.js',
|
||||
time: true,
|
||||
instances: 1,
|
||||
autorestart: true,
|
||||
max_restarts: 50,
|
||||
watch: false,
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
},
|
||||
},
|
||||
],
|
||||
deploy: {
|
||||
production: {
|
||||
user: 'deployer',
|
||||
host: '45.76.5.44',
|
||||
key: 'deploy.key',
|
||||
ref: 'origin/main',
|
||||
repo: 'git@git.leomurca.xyz:leomurca/embroidery-viewer.git',
|
||||
path: '/home/deployer/embroidery-viewer',
|
||||
'pre-deploy': 'rm package-lock.json && npm i',
|
||||
'post-deploy':
|
||||
'npm run build && pm2 reload ecosystem.config.cjs --only acelera-alagoas-prod --env production && pm2 save',
|
||||
env: {
|
||||
PORT: 7017,
|
||||
NODE_ENV: 'production',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Add table
Reference in a new issue