Fix Redis evicting all keys by correcting maxmemory and eviction policy #52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Hetzner | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build | |
| run: bun run build | |
| - name: Prepare standalone output | |
| run: | | |
| cp -r .next/static .next/standalone/.next/static | |
| cp -r public .next/standalone/public | |
| - name: Setup SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key | |
| chmod 600 ~/.ssh/deploy_key | |
| ssh-keyscan -p 1993 -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts | |
| - name: Deploy standalone to server | |
| run: | | |
| rsync -avz --delete \ | |
| -e "ssh -i ~/.ssh/deploy_key -p 1993" \ | |
| .next/standalone/ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }}/ | |
| - name: Write .env file | |
| run: | | |
| ssh -i ~/.ssh/deploy_key -p 1993 ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} "printf '%s\n' \ | |
| 'PORT=3001' \ | |
| 'ANALYTICS_KEY=${{ secrets.ANALYTICS_KEY }}' \ | |
| 'REDIS_URL=${{ secrets.REDIS_URL }}' \ | |
| > ${{ secrets.DEPLOY_PATH }}/.env" | |
| - name: Restart PM2 | |
| run: | | |
| ssh -i ~/.ssh/deploy_key -p 1993 ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} "\ | |
| cd ${{ secrets.DEPLOY_PATH }} && \ | |
| pm2 delete prayCalendar 2>/dev/null || true && \ | |
| set -a && source .env && set +a && \ | |
| pm2 start server.js --name prayCalendar && \ | |
| pm2 save" |