Skip to content

Commit

Permalink
docker added
Browse files Browse the repository at this point in the history
  • Loading branch information
carol80 committed Aug 2, 2020
1 parent f3c2f46 commit 14f3cc3
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 0 deletions.
4 changes: 4 additions & 0 deletions load_balancer/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/README.md
**/Dockerfile
**/docker-compose.yml
**/.env
38 changes: 38 additions & 0 deletions load_balancer/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is a basic workflow to help you get started with Actions

name: Deploy loadbalancer

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]


# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Run a one-line script
run: echo Hello, world!


- name: Deploy package to digitalocean
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.BALANCER_HOST }}
username: ${{ secrets.BALANCER_USERNAME }}
password: ${{ secrets.BALANCER_PASSWORD }}
port: ${{ secrets.BALANCER_PORT }}
script: |
cd /app/gearstalk_load_balancer
git pull
docker-compose up -d --build
1 change: 1 addition & 0 deletions load_balancer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/env
11 changes: 11 additions & 0 deletions load_balancer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.7-slim

WORKDIR /app
RUN apt-get update && apt-get -y dist-upgrade
RUN apt install -y netcat
COPY requirements.txt /app
RUN pip install -r /app/requirements.txt

COPY mediator.py /app


37 changes: 37 additions & 0 deletions load_balancer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: '3'
services:
main:
container_name: main
networks:
- loadbalancer
env_file:
- .env
build : .
restart: always
command: >
/bin/sh -c "
echo Waiting for rabbitmq service start...;
while ! nc -z rabbit 5672;
do
sleep 1;
done;
echo Connected!;
python mediator.py
"
rabbit:
restart: always
networks:
- loadbalancer
image: "bitnami/rabbitmq:3.7.17"
container_name: rabbit
ports:
- "15672:15672"
- "5672:5672"
env_file:
- .env

networks:
loadbalancer: {}

0 comments on commit 14f3cc3

Please sign in to comment.