Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
efa207d
Fixed bootstrap table not showing and other minor bugs
maheshkasabe Jun 3, 2023
e258f1e
Added Local dockerfile & docker-compose support
maheshkasabe Jun 8, 2023
0b93870
Added enviornment variables inside docker-compose setup and developme…
maheshkasabe Jun 11, 2023
d292024
Added an ECR Build & Deploy workflow
maheshkasabe Jun 11, 2023
efee21f
Added elasticsearch support for docker-compose file & deploy workflow
maheshkasabe Jun 21, 2023
6cfc7b0
Added environment variable support for production file
maheshkasabe Jun 25, 2023
9d1336b
Some additions to Production file
maheshkasabe Jun 26, 2023
9249d89
Added some comments for better understanding
maheshkasabe Jun 30, 2023
f8ce6e9
Added some extra workflows for quality & labeling
maheshkasabe Jul 2, 2023
cc653d8
Removed docker-compose volume to install bower compoenents
maheshkasabe Jul 2, 2023
20fa485
updated postgres version and added libpq-dev package
maheshkasabe Jul 3, 2023
acf602b
Mac docker install issues resolved
maheshkasabe Jul 8, 2023
0c5b156
Added Trivy Scanner
maheshkasabe Jul 19, 2023
2910aba
Added some extra imporvements
maheshkasabe Jul 19, 2023
c815599
Added dockerhub ci workflow
maheshkasabe Jul 24, 2023
95d2d23
Added workflow rule to push image only on merging to master branch
maheshkasabe Jul 24, 2023
a41879e
Added Comments
maheshkasabe Aug 5, 2023
7ca2918
Added some more comments
maheshkasabe Aug 5, 2023
4f4cb0f
added a actions-pipeline inside pr-labeler.yml
maheshkasabe Aug 6, 2023
55c9812
Renamed workflow
maheshkasabe Aug 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy to ECR

on:
pull_request_target:
types:
- closed

jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:

- name: Check out code
uses: actions/checkout@v2

- name: Build the Docker-compose file
run: docker-compose -f "docker-compose.yaml" up -d --build

- name: Show containers
run: docker ps -a

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public

- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REGISTRY_ALIAS: ${{ secrets.AWS_REGISTRY_ALIAS }}
ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPOSITORY }}
IMAGE_TAG: ${{ steps.vars.outputs.sha_short }}
run: |
docker build -t $ECR_REGISTRY/$REGISTRY_ALIAS/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$REGISTRY_ALIAS/$ECR_REPOSITORY:$IMAGE_TAG
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ubuntu:18.04 AS prod
WORKDIR /app
RUN apt-get -y update && apt-get install -y npm && apt-get install -y git
RUN npm install bower -g
RUN apt-get install -y python-pip && pip install --upgrade pip
COPY . /app
RUN pip install -r requirements.txt
RUN sh install.sh
EXPOSE 8000
2 changes: 0 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
"animate.css": "^3.5.2",
"cytoscape": "^2.7.11",
"webcola": "^3.3.0",
"bootstrap": "^3.3.7",
"cytoscape-cola": "^1.6.0",
"intro.js": "^2.4.0",
"jquery-ui": "^1.12.1",
"bootstrap-table": "^1.11.0",
"cytoscape-panzoom": "^2.4.0",
"select2": "select2-dist#^4.0.3",
"cytoscape-context-menus": "^2.1.1",
Expand Down
7 changes: 7 additions & 0 deletions db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
echo "enabling pg_trgm & btree_gin on database $POSTGRES_DB"
psql -U $POSTGRES_USER --dbname="$POSTGRES_DB" <<-'EOSQL'
create extension if not exists pg_trgm;
create extension if not exists btree_gin;
EOSQL
echo "finished with exit code $?"
14 changes: 14 additions & 0 deletions docker-compose.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.4"
services:
graphspace:
restart: always
stdin_open: true # docker run -i
tty: true # docker run -t
build:
context: .
ports:
- "8000:8000"
volumes:
- .:/app
command: >
sh -c "python manage.py migrate && python manage.py runserver"
38 changes: 38 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: "3.4"
services:
db:
image: postgres
restart: always
environment:
POSTGRES_DB: graphspace
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/PostgreSQL/data
- ./db.sh:/docker-entrypoint-initdb.d/create_extensions.sh

graphspace:
restart: always
environment:
POSTGRES_HOST: db
POSTGRES_DB: graphspace
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
stdin_open: true # docker run -i
tty: true # docker run -t
build:
context: .
ports:
- "8000:8000"
volumes:
- .:/app
command: >
sh -c "python manage.py migrate --settings=graphspace.settings.local &&
python manage.py runserver 0.0.0.0:8000 --settings=graphspace.settings.local"
depends_on:
- db

volumes:
pgdata:
8 changes: 4 additions & 4 deletions graphspace/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'test_database',
'USER': 'adb',
'PASSWORD': '',
'HOST': 'localhost',
'NAME': os.environ.get('POSTGRES_DB', 'graphspace'),
'USER': os.environ.get('POSTGRES_USER', 'postgres'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD', 'postgres'),
'HOST': os.environ.get('POSTGRES_HOST', 'localhost'),
'PORT': '5432'
}
}
2 changes: 2 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
python setup.py install
python manage.py migrate --settings=graphspace.settings.local
bower install
bower install bootstrap#3.3.7
bower install bootstrap-table#1.11.0
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MarkupSafe==0.23
networkx==1.11
oauthlib==1.1.2
poster==0.8.1
psycopg2==2.6.2
psycopg2==2.7.4
py-bcrypt==0.4
Pygments==2.5.2
pytz==2016.4
Expand All @@ -29,3 +29,5 @@ sphinx-rtd-theme
sphinx
recommonmark
python-dotenv==0.15.0
lxml
psycopg2-binary