deploy
This commit is contained in:
parent
f150f60a8a
commit
2969ee9ef5
4 changed files with 32 additions and 5 deletions
|
|
@ -90,6 +90,22 @@ jobs:
|
|||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Setup Swap
|
||||
run: |
|
||||
SWAP_SIZE=2048 # 2GB
|
||||
CURRENT_SWAP=$(free -m | awk '/^Swap:/ {print $2}' || echo "0")
|
||||
|
||||
if [ "$CURRENT_SWAP" -lt "$SWAP_SIZE" ]; then
|
||||
echo "Creating ${SWAP_SIZE}MB swap file..."
|
||||
dd if=/dev/zero of=/tmp/swapfile bs=1M count=$SWAP_SIZE status=progress
|
||||
chmod 600 /tmp/swapfile
|
||||
mkswap /tmp/swapfile
|
||||
swapon /tmp/swapfile
|
||||
echo "Swap activated: $(free -m | awk '/^Swap:/ {print $2}')MB"
|
||||
else
|
||||
echo "Swap already available: ${CURRENT_SWAP}MB"
|
||||
fi
|
||||
|
||||
- name: Build Web App
|
||||
working-directory: mnemo_cards_web_v2
|
||||
run: |
|
||||
|
|
@ -98,6 +114,16 @@ jobs:
|
|||
--dart-define=API_BASE_URL=https://api.mnemo-cards.online \
|
||||
--dart2js-optimization=O4
|
||||
|
||||
- name: Remove Swap
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f /tmp/swapfile ]; then
|
||||
echo "Removing swap file..."
|
||||
swapoff /tmp/swapfile 2>/dev/null || true
|
||||
rm -f /tmp/swapfile
|
||||
echo "Swap removed"
|
||||
fi
|
||||
|
||||
- name: Deploy Web App
|
||||
run: |
|
||||
rsync -avz --delete mnemo_cards_web_v2/build/web/ \
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ server {
|
|||
|
||||
# Proxy to HTTP backend (SSL termination in nginx)
|
||||
location / {
|
||||
proxy_pass http://localhost:8081;
|
||||
proxy_pass http://127.0.0.1:8081;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ server {
|
|||
|
||||
# Proxy to HTTP backend (SSL termination in nginx)
|
||||
location / {
|
||||
proxy_pass http://localhost:8081;
|
||||
proxy_pass http://127.0.0.1:8081;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
|
|
|||
|
|
@ -48,9 +48,10 @@ ssh "$SERVER_USER@$SERVER_IP" << 'ENDSSH'
|
|||
# Backup nginx config
|
||||
cp /etc/nginx/sites-available/api /etc/nginx/sites-available/api.backup.$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
# Update proxy_pass to use port 8081
|
||||
sed -i 's|proxy_pass https://localhost:8443|proxy_pass https://localhost:8081|g' /etc/nginx/sites-available/api
|
||||
sed -i 's|proxy_pass http://localhost:8443|proxy_pass http://localhost:8081|g' /etc/nginx/sites-available/api
|
||||
# Update proxy_pass to use port 8081 and 127.0.0.1 (IPv4) instead of localhost (IPv6)
|
||||
sed -i 's|proxy_pass https://localhost:8443|proxy_pass http://127.0.0.1:8081|g' /etc/nginx/sites-available/api
|
||||
sed -i 's|proxy_pass http://localhost:8443|proxy_pass http://127.0.0.1:8081|g' /etc/nginx/sites-available/api
|
||||
sed -i 's|proxy_pass http://localhost:8081|proxy_pass http://127.0.0.1:8081|g' /etc/nginx/sites-available/api
|
||||
|
||||
echo "Updated proxy_pass:"
|
||||
grep "proxy_pass" /etc/nginx/sites-available/api | head -3
|
||||
|
|
|
|||
Loading…
Reference in a new issue