-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from J-A-A-M/analytics
Технічне: Додано аналітику
- Loading branch information
Showing
8 changed files
with
263 additions
and
32 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
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,30 @@ | ||
name: 🧪 Deploy Dev Websockets | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
random_mode: | ||
type: boolean | ||
default: false | ||
description: Random Alerst Mode | ||
fetch_interval: | ||
type: number | ||
default: 1 | ||
description: Memcached Fetch Interval (seconds) | ||
|
||
run-name: Deploy Dev Websockets from '${{ github.ref_name }}' branch | ||
jobs: | ||
deploy_websocket_dev: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Redeploy Dev WebSockets | ||
uses: appleboy/ssh-action@v1.0.3 | ||
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 }} -r ${{ inputs.random_mode && 'True' || 'False' }} -f ${{ inputs.fetch_interval }} |
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
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,88 @@ | ||
#!/bin/bash | ||
|
||
# Default values | ||
MEMCACHED_HOST="" | ||
WEBSOCKET_PORT=38447 | ||
DEBUG_LEVEL="INFO" | ||
PING_INTERVAL=60 | ||
ENVIRONMENT="DEV" | ||
RANDOM_MODE="False" | ||
MEMCACHE_FETCH_INTERVAL=1 | ||
|
||
# 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 | ||
;; | ||
-r|--random-mode) | ||
RANDOM_MODE="$2" | ||
shift 2 | ||
;; | ||
-f|--fetch-interval) | ||
MEMCACHE_FETCH_INTERVAL="$2" | ||
shift 2 | ||
;; | ||
*) | ||
echo "Unknown argument: $1" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
echo "WEBSOCKET SERVER DEV" | ||
|
||
echo "MEMCACHED_HOST: $MEMCACHED_HOST" | ||
echo "WEBSOCKET_PORT: $WEBSOCKET_PORT" | ||
echo "DEBUG_LEVEL: $DEBUG_LEVEL" | ||
echo "PING_INTERVAL: $PING_INTERVAL" | ||
echo "ENVIRONMENT: $ENVIRONMENT" | ||
echo "RANDOM_MODE: $RANDOM_MODE" | ||
echo "MEMCACHE_FETCH_INTERVAL: $MEMCACHE_FETCH_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" --env ENVIRONMENT="$ENVIRONMENT" --env RANDOM_MODE="$RANDOM_MODE" --env MEMCACHE_FETCH_INTERVAL="$MEMCACHE_FETCH_INTERVAL" map_websocket_server_dev | ||
|
||
echo "Container deployed successfully!" | ||
|
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
aiomcache==0.8.1 | ||
websockets==12.0 | ||
geoip2==4.8.0 | ||
geoip2==4.8.0 | ||
ga4mp==2.0.4 |
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
Oops, something went wrong.