-
Notifications
You must be signed in to change notification settings - Fork 0
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 #7 from EvilGenius13/EG-DC
Eg dc
- Loading branch information
Showing
11 changed files
with
300 additions
and
9 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,7 @@ | ||
__pycache__ | ||
.dockerignore | ||
Dockerfile | ||
*.md | ||
*.pyc | ||
*.pyo | ||
.git |
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,66 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build and start Docker containers | ||
run: | | ||
docker-compose up -d | ||
- name: Wait for the server to be up | ||
run: | | ||
while ! curl -s http://localhost:5000/ > /dev/null; do | ||
sleep 1 | ||
done | ||
- name: Run tests | ||
run: | | ||
docker exec -t pokebackpackfinal_pokeapp_1 python3 -m unittest discover -s /app/poke_app/ -p '*test.py' | ||
- name: Stop Docker containers | ||
run: docker-compose down | ||
|
||
build: | ||
needs: test | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
echo "DOCKER_TAG=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | ||
docker build -t evilgenius13/pokeapp:${DOCKER_TAG} . | ||
docker push evilgenius13/pokeapp:${DOCKER_TAG} |
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,36 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build and start Docker containers | ||
run: | | ||
docker-compose up -d | ||
- name: Wait for the server to be up | ||
run: | | ||
while ! curl -s http://localhost:5000/ > /dev/null; do | ||
sleep 1 | ||
done | ||
- name: Run tests | ||
run: | | ||
# Assuming you're running tests from within a container. | ||
docker exec -t pokebackpackfinal_pokeapp_1 python3 -m unittest discover -s /app/poke_app/ -p '*test.py' | ||
- name: Stop Docker containers | ||
run: docker-compose down |
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
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,45 @@ | ||
version: '3' # This is a deployment config for portainer. It pulls from the github repo. | ||
|
||
volumes: | ||
postgres_data: | ||
driver: local | ||
|
||
services: | ||
postgres: | ||
image: postgres:latest | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: Ash | ||
POSTGRES_PASSWORD: Ketchum | ||
POSTGRES_DB: pokeappdb | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U Ash"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 5s | ||
|
||
redis: | ||
image: redis:latest | ||
ports: | ||
- "6379:6379" | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "ping"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 5s | ||
|
||
pokeapp: | ||
build: . | ||
ports: | ||
- "5000:5000" | ||
environment: | ||
SECRET_KEY: pokemon | ||
DATABASE_URL: postgresql://Ash:Ketchum@postgres:5432/pokeappdb | ||
REDIS_URL: redis://redis:6379/0 | ||
depends_on: | ||
- postgres | ||
- redis | ||
command: /app/start-pokeapp.sh # Script command to watch for postgres and redis to be ready before starting the app |
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,54 @@ | ||
version: '3.8' # Newer Docker Compose version. This is a deployment config for portainer with docker swarm. It pulls from the github repo. | ||
|
||
volumes: | ||
postgres_data: | ||
driver: local | ||
|
||
services: | ||
postgres: | ||
image: postgres:latest | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: Ash | ||
POSTGRES_PASSWORD: Ketchum | ||
POSTGRES_DB: pokeappdb | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U Ash"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 5s | ||
|
||
redis: | ||
image: redis:latest | ||
ports: | ||
- target: 6379 | ||
published: 6379 | ||
protocol: tcp | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "ping"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 5s | ||
|
||
pokeapp: | ||
image: evilgenius13/pokeapp:v2.3 | ||
ports: | ||
- target: 5000 | ||
published: 5000 | ||
protocol: tcp | ||
environment: | ||
SECRET_KEY: pokemon | ||
DATABASE_URL: postgresql://Ash:Ketchum@postgres:5432/pokeappdb | ||
REDIS_URL: redis://redis:6379/0 | ||
depends_on: | ||
- postgres | ||
- redis | ||
command: /app/start-pokeapp.sh | ||
deploy: | ||
replicas: 3 | ||
update_config: | ||
parallelism: 1 | ||
delay: 10s |
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,18 +1,45 @@ | ||
version: '3' | ||
|
||
volumes: | ||
postgres_data: | ||
driver: local | ||
|
||
services: | ||
postgres: | ||
image: postgres:latest | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: Ash | ||
POSTGRES_PASSWORD: Ketchum | ||
POSTGRES_DB: pokeappdb | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U Ash"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 5s | ||
|
||
redis: | ||
image: redis:latest | ||
ports: | ||
- "6379:6379" | ||
healthcheck: | ||
test: ["CMD", "redis-cli", "ping"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 5s | ||
|
||
pokeapp: | ||
image: evilgenius13/pokeapp:latest | ||
image: evilgenius13/pokeapp:v2.3 | ||
ports: | ||
- "5000:5000" | ||
environment: | ||
SECRET_KEY: pokemon | ||
DATABASE_URL: postgresql://Ash:Ketchum@postgres:5432/pokeappdb | ||
REDIS_URL: redis://redis:6379/0 | ||
depends_on: | ||
- postgres | ||
- redis | ||
command: /app/start-pokeapp.sh # Script command to watch for postgres and redis to be ready before starting the app |
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
Oops, something went wrong.