-
Notifications
You must be signed in to change notification settings - Fork 6
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 #5 from samcrane8/master
Pull from fork
- Loading branch information
Showing
12 changed files
with
126 additions
and
110 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 |
---|---|---|
|
@@ -2,4 +2,7 @@ push_backend.sh | |
push_all.sh | ||
*.env | ||
.idea/ | ||
env/ | ||
env/ | ||
.vscode/ | ||
*.crt | ||
*.key |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -11,4 +11,6 @@ then | |
echo "PostgreSQL started" | ||
fi | ||
|
||
cd business-logic-server | ||
|
||
exec "$@" |
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 |
---|---|---|
@@ -1,31 +1,40 @@ | ||
# pull official base image | ||
FROM python:3.6-alpine | ||
FROM ubuntu:bionic | ||
|
||
# set work directory | ||
WORKDIR /usr/src/app | ||
|
||
# set environment varibles | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# install psycopg2 | ||
RUN apk update \ | ||
&& apk add --virtual build-deps gcc python3-dev musl-dev \ | ||
&& apk add postgresql-dev \ | ||
&& pip install psycopg2 \ | ||
&& apk del build-deps | ||
RUN apt-get update -qq && apt-get install -y -qq \ | ||
# std libs | ||
unzip wget sudo less nano curl git gosu build-essential software-properties-common \ | ||
# python basic libs | ||
python3.7 python3.7-dev gettext \ | ||
# geodjango | ||
gdal-bin binutils libproj-dev libgdal-dev \ | ||
netcat \ | ||
# postgresql | ||
libpq-dev postgresql-client && \ | ||
apt-get clean all && rm -rf /var/apt/lists/* && rm -rf /var/cache/apt/* | ||
|
||
# install dependencies | ||
RUN pip install --upgrade pip | ||
RUN pip install pipenv | ||
COPY ../Pipfile /usr/src/app/Pipfile | ||
RUN pipenv install --skip-lock --system | ||
# install pip | ||
RUN wget https://bootstrap.pypa.io/get-pip.py && python3.7 get-pip.py && rm get-pip.py | ||
RUN pip3 install --no-cache-dir setuptools wheel -U | ||
|
||
ENV LANG=C.UTF-8 | ||
|
||
# copy entrypoint-prod.sh | ||
COPY ./entrypoint.prod.sh /usr/src/app/entrypoint.prod.sh | ||
# install dependencies | ||
RUN pip3 install --upgrade pip | ||
COPY requirements.txt /usr/src/app/requirements.txt | ||
RUN pip3 install -r requirements.txt | ||
|
||
# copy project | ||
COPY .. /usr/src/app/ | ||
COPY . /usr/src/app/ | ||
|
||
|
||
# run entrypoint.prod.sh | ||
ENTRYPOINT ["/usr/src/app/entrypoint.prod.sh"] | ||
# run entrypoint.sh | ||
ENTRYPOINT ["/usr/src/app/business-logic-server/entrypoint.prod.sh"] |
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 @@ | ||
import os | ||
from icarus_backend.wsgi import * | ||
from icarus_backend.pilot.PilotModel import Pilot | ||
from users.models import IcarusUser as User | ||
from oauth2_provider.models import Application | ||
from icarus_backend.department.DepartmentModel import Department | ||
from django.contrib.gis.geos import Polygon | ||
from icarus_backend.drone.DroneModel import Drone | ||
|
||
|
||
user = User.objects.filter(username=os.environ.get('SUPERUSER_USERNAME', 'admin')).first() | ||
if not user: | ||
user = User.objects.create_superuser(os.environ.get('SUPERUSER_USERNAME', 'admin'), os.environ.get('SUPERUSER_EMAIL', '[email protected]'), os.environ.get('SUPERUSER_PASSWORD', 'password')) | ||
|
||
pilot = Pilot( | ||
user=user, | ||
remotePilotCertificateNumber='123', | ||
mobilePhoneNumber='123-456-7890' | ||
) | ||
user.save() | ||
|
||
airboss = User.objects.filter(id='1') | ||
|
||
department = Department( | ||
owner = user, | ||
area = Polygon([ | ||
(33.781572902565564, -84.40757274627684), | ||
(33.77668601962971, -84.40735816955566), | ||
(33.774795398883406, -84.4064998626709), | ||
(33.773118775767486, -84.4019079208374), | ||
(33.77276204321162, -84.3975305557251), | ||
(33.771477793711874, -84.39650058746338), | ||
(33.77137077205131, -84.39229488372803), | ||
(33.76844546156616, -84.39225196838379), | ||
(33.7685168117906, -84.39066410064697), | ||
(33.781572902565564, -84.39096450805664), | ||
(33.781465893516334, -84.39478397369385), | ||
(33.782892669846134, -84.3946123123169), | ||
(33.783142353260104, -84.39701557159424), | ||
(33.781572902565564, -84.39723014831543), | ||
(33.781572902565564, -84.40757274627684) | ||
]), | ||
name = "Georgia Tech Police Department", | ||
# airbosses = user | ||
# create an airboss template | ||
) | ||
department.save() | ||
department.airbosses.set(airboss) | ||
|
||
|
||
drone = Drone( | ||
id = "c0d59f57-ae0b-47ec-8ec6-a0434468d851", | ||
owner = user, | ||
description = "Test Drone Description", | ||
name = "Test Drone", | ||
manufacturer = "DJI", | ||
type = "Rotor", | ||
faa_registration_number = "123", | ||
color = "White", | ||
) | ||
|
||
drone.save() | ||
pilot.save() | ||
|
||
application = Application(client_id='client_id', client_secret='client_secret', client_type='confidential', name='webapp', authorization_grant_type='password') | ||
application.save() |
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 |
---|---|---|
|
@@ -12,10 +12,10 @@ services: | |
business-logic: | ||
build: | ||
context: business-logic-server | ||
dockerfile: Dockerfile | ||
command: python3.7 manage.py runserver 0.0.0.0:8000 | ||
dockerfile: prod.Dockerfile | ||
command: gunicorn --bind 0.0.0.0:8000 icarus_backend.wsgi:application | ||
environment: | ||
- DJANGO_DEBUG=enabled | ||
- DJANGO_DEBUG=disabled | ||
- SQL_DATABASE=gis | ||
- FLYRIGHT_BUILD=DEV | ||
- SQL_HOST=db | ||
|
@@ -29,7 +29,7 @@ services: | |
- SUPERUSER_USERNAME=admin | ||
- SUPERUSER_PASSWORD=password | ||
- [email protected] | ||
- SLACKBOT_ENABLED=disabled | ||
- SLACKBOT_ENABLED=enabled | ||
env_file: business-logic.env | ||
volumes: | ||
- .:/usr/src/app | ||
|
@@ -58,15 +58,29 @@ services: | |
- 8080 | ||
nginx: | ||
build: ./nginx | ||
environment: | ||
- WEBAPP_DOMAIN=flyright.police.gatech.edu | ||
- API_DOMAIN=flyright-api.police.gatech.edu | ||
ports: | ||
- 80:80 | ||
- 443:443 | ||
depends_on: | ||
- web | ||
- business-logic | ||
redis: | ||
image: redis | ||
container_name: cache | ||
expose: | ||
- 6379 | ||
ports: | ||
- 6379:6379 | ||
celery-worker: | ||
build: | ||
context: business-logic-server | ||
dockerfile: prod.Dockerfile | ||
command: celery worker -A icarus_backend --loglevel=debug --concurrency=1 | ||
volumes: | ||
- .:/usr/src/app | ||
depends_on: | ||
- redis | ||
links: | ||
- redis | ||
|
||
volumes: | ||
postgres_data: |
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,4 +1,6 @@ | ||
FROM nginx:1.15.12-alpine | ||
|
||
RUN rm /etc/nginx/conf.d/default.conf | ||
COPY nginx.conf /etc/nginx/conf.d | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
ENTRYPOINT ["entrypoint.sh"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.