Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First set of API refactor changes #797

Merged
merged 16 commits into from
Nov 2, 2020
Merged
63 changes: 24 additions & 39 deletions server/.env.example
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@

############################### API SETTINGS #############################

# Server
HOST=0.0.0.0
PORT=5000
DEBUG=0
ACCESS_LOG=1
AUTO_RELOAD=1
WORKERS=1
TMP_DIR=./__tmp__
UPDATE_ON_START=0

# Database
DATABASE_URL=postgresql://311_user:311_pass@db:5432/311_db
DATABASE_LOG_QUERIES=0

# Redis
REDIS_ENABLED=1
REDIS_URL=redis://redis:6379
REDIS_TTL_SECONDS=3600

# Picklebase
PICKLEBASE_ENABLED=0
PICKLEBASE_BATCH_SIZE=400000

# Picklecache
PICKLECACHE_ENABLED=0
PICKLECACHE_TTL_SECONDS=3600

######################### DOCKER-COMPOSE SETTINGS ########################

COMPOSE_PROJECT_NAME=311_data

# host/public configs
API_HOST_PORT=5000
DB_HOST_PORT=5433

# api config
DEBUG=True
API_RESTART_POLICY=no
APP_PORT=5000

# db connection config
DB_HOST=db
DB_PORT=5432
DB_USER=311_user
DB_PASS=311_pass
DB_NAME=311_db
DB_ECHO=False

############################ 3RD PARTY TOOLS ##############################

# Socrata
SOCRATA_TOKEN=
Expand All @@ -45,14 +40,4 @@ SLACK_ERROR_CODES=[400, 500]
# Sendgrid
SENDGRID_API_KEY=

######################### DOCKER-COMPOSE SETTINGS ########################

COMPOSE_PROJECT_NAME=311_data
DB_USER=311_user
DB_PASS=311_pass
DB_NAME=311_db
DB_HOST_PORT=5433
API_HOST_PORT=5000
API_RESTART_POLICY=no

################################# OVERRIDES ##############################
############################################################################
5 changes: 5 additions & 0 deletions server/api/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ignore .git and .cache folders
Pipfile
Pipfile.lock
__pycache__
__tmp__
26 changes: 10 additions & 16 deletions server/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
FROM python:3.7-slim
FROM python:3.7

RUN apt-get update && \
apt-get install -yq \
python3 \
python3-dev \
gcc \
g++ \
gfortran \
musl-dev && \
pip install --upgrade pip
WORKDIR /home/api

COPY requirements.txt /home/api/
COPY requirements.txt .

RUN pip install --no-cache-dir -r /home/api/requirements.txt

COPY setup.cfg /home/api/
COPY /bin /home/api/bin/
COPY .env* /src /home/api/src/
COPY . .

WORKDIR /home/api
ENV APP_HOST=0.0.0.0
# need add the src folder to sys.path for compatibility
ENV PYTHONPATH=/home/api/src

EXPOSE 5000

CMD python bin/api_check.py && python bin/api_start.py
CMD python code/run.py
4 changes: 4 additions & 0 deletions server/api/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ sendgrid = "*"
sodapy = "*"
SQLAlchemy = "*"
tabulate = "*"
gino = {extras = ["starlette"], version = "*"}
fastapi = "*"
uvicorn = "*"
gunicorn = "*"

[requires]
python_version = "3.7"
151 changes: 146 additions & 5 deletions server/api/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading