Skip to content

Commit

Permalink
Merge pull request #22 from Maxcutex/pm-api/codedeploy
Browse files Browse the repository at this point in the history
Pm api/codedeploy
  • Loading branch information
Maxcutex committed Jan 31, 2021
2 parents 01ac848 + fd48e80 commit 39d6db6
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,11 @@ workflows:
bundle-key: pmS3BucketKey
deployment-group: pm-deploment-group
service-role-arn: arn:aws:iam::aws:policy/service-role/AWSCodeDeployRole
requires:
- build
filters:
branches:
only:
- development


1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,4 @@ jwt-key.pub

#redis locally
redis-stable

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM python:3.7-alpine
FROM python:3.8.7-buster
WORKDIR /usr/src
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV FLASK_APP=run.py
ENV FLASK_ENV=development
ENV FLASK_RUN_HOST 0.0.0.0
RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev
RUN apt-get update && apt-get install -y postgresql gcc python3-dev musl-dev build-essential libssl-dev libffi-dev
RUN pip install --upgrade pip
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
Expand Down
9 changes: 9 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 0.0
os: linux
files:
- source: /
destination: /var/www/html/PM-API
hooks:
ApplicationStart:
- location: scripts/start_server
timeout: 300
26 changes: 20 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ services:
build: .
depends_on:
- db
- redis
environment:
APP_ENV: development
STAGE: test
SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://test:test@db/test
# SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://test:test@db/test
DATABASE_URL: postgresql://pm_admin:mypassword@db:5432/pm_db
REDIS_URL: redis://redis:6379
networks:
- default
ports:
Expand All @@ -17,15 +21,25 @@ services:
restart: always

db:
environment:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
image: postgres:latest
environment:
- POSTGRES_USER=pm_admin
- POSTGRES_PASSWORD=mypassword
- POSTGRES_DB=pm_db
networks:
- default
ports:
- 5405:5432
restart: always
volumes:
- ./postgres-data:/var/lib/postgresql/data
- postgres_data:/var/lib/postgresql/data

redis:
image: "redis:alpine"
networks:
- default
ports:
- "6379:6379"

volumes:
postgres_data:
6 changes: 6 additions & 0 deletions scripts/install_dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
sudo apt install -y python3-pip
pip3 install virtualenv
cd /var/www/html/PM-API
source pm-api/bin/activate
pip install -r requirements.txt
8 changes: 8 additions & 0 deletions scripts/start_server
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
cd /var/www/html/PM-API
docker-compose up -d





0 comments on commit 39d6db6

Please sign in to comment.