-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: 🧪 Deploy Dev Websockets | ||
on: workflow_dispatch | ||
|
||
run-name: Deploy Dev Websockets from '${{ github.ref_name }}' branch | ||
jobs: | ||
deploy_microservices: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Redeploy Dev WebSockets | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SERVER_IP }} | ||
username: ${{ secrets.SERVER_SSH_USER }} | ||
password: ${{ secrets.SERVER_SSH_PASSWORD }} | ||
script: | | ||
cd /root/ukraine_alarm_map/deploy/ | ||
git fetch --all | ||
git checkout ${{ github.ref_name }} | ||
git pull | ||
bash redeploy_websocket_server_dev.sh -m ${{ secrets.MEMCACHED_HOST }} -s ${{ secrets.API_SECRET }} -i ${{ secrets.MEASUREMENT_ID }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
|
||
# Default values | ||
MEMCACHED_HOST="" | ||
WEBSOCKET_PORT=38447 | ||
DEBUG_LEVEL="INFO" | ||
PING_INTERVAL=60 | ||
|
||
# Check for arguments | ||
while [[ $# -gt 0 ]]; do | ||
case "$1" in | ||
-a|--tcp-port) | ||
WEBSOCKET_PORT="$2" | ||
shift 2 | ||
;; | ||
-m|--memcached-host) | ||
MEMCACHED_HOST="$2" | ||
shift 2 | ||
;; | ||
-s|--api-secret) | ||
API_SECRET="$2" | ||
shift 2 | ||
;; | ||
-i|--measurement-id) | ||
MEASUREMENT_ID="$2" | ||
shift 2 | ||
;; | ||
-d|--debug-level) | ||
DEBUG_LEVEL="$2" | ||
shift 2 | ||
;; | ||
-p|--ping-interval) | ||
PING_INTERVAL="$2" | ||
shift 2 | ||
;; | ||
*) | ||
echo "Unknown argument: $1" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
echo "WEBSOCKET SERVER" | ||
|
||
echo "MEMCACHED_HOST: $MEMCACHED_HOST" | ||
echo "WEBSOCKET_PORT: $WEBSOCKET_PORT" | ||
echo "DEBUG_LEVEL: $DEBUG_LEVEL" | ||
echo "PING_INTERVAL: $PING_INTERVAL" | ||
|
||
|
||
# Updating the Git repo | ||
echo "Updating Git repo..." | ||
#cd /path/to/your/git/repo | ||
git pull | ||
|
||
# Moving to the deployment directory | ||
echo "Moving to deployment directory..." | ||
cd websocket_server | ||
|
||
# Building Docker image | ||
echo "Building Docker image..." | ||
docker build -t map_websocket_server_dev -f Dockerfile . | ||
|
||
# Stopping and removing the old container (if exists) | ||
echo "Stopping and removing old container..." | ||
docker stop map_websocket_server_dev || true | ||
docker rm map_websocket_server_dev || true | ||
|
||
# Deploying the new container | ||
echo "Deploying new container..." | ||
docker run --name map_websocket_server_dev --restart unless-stopped -d -p "$WEBSOCKET_PORT":"$WEBSOCKET_PORT" --env WEBSOCKET_PORT="$WEBSOCKET_PORT" --env API_SECRET="$API_SECRET" --env MEASUREMENT_ID="$MEASUREMENT_ID" --env DEBUG_LEVEL="$DEBUG_LEVEL" --env PING_INTERVAL="$PING_INTERVAL" --env MEMCACHED_HOST="$MEMCACHED_HOST" map_websocket_server_dev | ||
|
||
echo "Container deployed successfully!" | ||
|