Skip to content

Commit

Permalink
Add deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
LVala committed Aug 1, 2023
1 parent fa0af0a commit 1dc8e3d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and publish Docker image
name: Build and publish Docker image, deploy

on:
push:
Expand Down Expand Up @@ -45,3 +45,28 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
runs-on: ubuntu-latest
needs: build-and-push-image
steps:
- uses: actions/checkout@v3
- name: Prepare .env file for the deployment
env:
GF_SECURITY_ADMIN_PASSWORD: ${{ secrets.GF_SECURITY_ADMIN_PASSWORD }}
GF_SECURITY_ADMIN_USER: ${{ secrets.GF_SECURITY_ADMIN_USER }}
run: echo "DOMAIN=${{ secrets.DOMAIN }} \nGF_SECURITY_ADMIN_PASSWORD=$GF_SECURITY_ADMIN_PASSWORD \nGF_SECURITY_ADMIN_USER=$GF_SECURITY_ADMIN_USER" > .env
- name: Remove existing containers
uses: JimCronqvist/action-ssh@master
with:
hosts: ${{ secrets.SSH_HOST }}
privateKey: ${{ secrets.PRIV_KEY }}
command: docker rm -f turn grafana prometheus
- name: Deploy docker compose to pre-configured server
uses: TapTap21/[email protected]
with:
remote_docker_host: ${{ secrets.SSH_HOST }}
ssh_private_key: ${{ secrets.PRIV_KEY }}
ssh_public_key: ${{ secrets.PUB_KEY }}
stack_file_name: docker-compose.yml
args: -p turn --env-file .env -d --remove-orphans

5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ services:
container_name: turn
restart: on-failure
network_mode: host
env_file: .env
environment:
LISTEN_IP: 0.0.0.0
REPLAY_IP: 0.0.0.0
DOMAIN: "${DOMAIN}"

prometheus:
image: prom/prometheus:v2.46.0
Expand Down
4 changes: 3 additions & 1 deletion lib/ex_turn_app.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ defmodule ExTURN.App do

require Logger

@version Mix.Project.config[:version]

@impl true
def start(_, _) do
Logger.info("Starting ExTURN...")
Logger.info("Starting ExTURN v#{version}...")

listen_ip = Application.fetch_env!(:ex_turn, :listen_ip)
listen_port = Application.fetch_env!(:ex_turn, :listen_port)
Expand Down

0 comments on commit 1dc8e3d

Please sign in to comment.