-
Notifications
You must be signed in to change notification settings - Fork 4
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 #1602 from cityofaustin/v2.4.0
v2.4.0
- Loading branch information
Showing
43 changed files
with
944 additions
and
276 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -89,3 +89,5 @@ env | |
|
||
# Zappa API deployment secrets | ||
zappa_settings.json | ||
|
||
env_file |
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,3 @@ | ||
.env | ||
docker-compose.yaml | ||
README.md |
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,8 +1,10 @@ | ||
API_ENVIRONMENT="STAGING" | ||
AUTH0_DOMAIN="atd-datatech.auth0.com" | ||
CLIENT_ID="2qbqz2sf8L9idBOwn0d5YA9efNgQbL7c" | ||
AWS_DEFALUT_REGION="us-east-1" | ||
AWS_DEFAULT_REGION="us-east-1" | ||
AWS_S3_CR3_LOCATION="staging/path_to_files" | ||
AWS_S3_BUCKET="your_bucket_name_here" | ||
AWS_S3_KEY="your_s3_key_here" | ||
AWS_S3_SECRET="your_s3_secret_here" | ||
AWS_S3_SECRET="your_s3_secret_here" | ||
API_CLIENT_ID= | ||
API_CLIENT_SECRET= |
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,21 @@ | ||
FROM python:3.13-slim | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Install dependencies | ||
COPY requirements.txt ./ | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy the application code | ||
COPY . . | ||
|
||
# Set environment variables | ||
ENV FLASK_APP=server.py | ||
ENV FLASK_ENV=development | ||
|
||
# Expose the default Flask port | ||
EXPOSE 5000 | ||
|
||
# Command to run the application | ||
CMD ["flask", "run", "--host=0.0.0.0", "--port=5000"] |
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,29 @@ | ||
# VZ User & CR3 API | ||
|
||
## Big Picture | ||
|
||
The API consists of a flask app which is bundled into a docker image and pushed to Docker Hub. It is deployed on AWS ECS as a service inside the VZ clusters. There is a `:production` and `:staging` version of the image, and these are built by CI on merger to the `production` and `main` branches respectively. | ||
|
||
Our endpoints can be found at: | ||
|
||
Staging: https://vision-zero-cr3-user-api-staging.austinmobility.io/ | ||
|
||
Production: https://vision-zero-cr3-user-api.austinmobility.io/ | ||
|
||
These flask apps are deployed as long-running tasks in ECS and are reverse proxy'd out to the internet by an AWS API gateway via a namespace / VPC link configuration. Specific deployment instructions for the COA deployment are contained in our internal documentation repositories. | ||
|
||
## Local usage | ||
|
||
You can start the API using either the project wide `docker compose` file with `docker compose up cr3-user-api` or if you prefer, you can use the `docker compose` stack that is concerned only with part of the stack as found in the `api` directory. Use whichever is best for your development needs. Additionally, you can use the `vision-zero` orchestration tool to `vision-zero api-up` and `vision-zero api-down` to start and stop the API. | ||
|
||
## Configuration | ||
|
||
The API requires certain environment variables to be set. Copy the `.env.example` file in the `api` directory to `.env` and fill in the values. | ||
|
||
## Secrets | ||
|
||
Please see the entry "Vision Zero (VZ) User & CR3 API Secrets" in the developers vault in 1PW for information about the secret values. | ||
|
||
## Testing the API / Is this thing on? | ||
|
||
Where ever you have the API running, you can hit it at the root of the domain `/` and you should get a health message that includes both the current time, but also the age of the process serving the API. This is helpful in confirming a restart has occurred, or that the API is up and running. |
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,12 @@ | ||
services: | ||
api: | ||
build: | ||
context: . | ||
ports: | ||
- "5000:5000" | ||
environment: | ||
- FLASK_ENV=production | ||
volumes: | ||
- .:/usr/src/app | ||
command: flask run --host=0.0.0.0 --port=5000 | ||
restart: unless-stopped |
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,9 @@ | ||
# pinning of major versions, allowing patch and minor updates. | ||
# For example, for boto3, the ~= operator is equivalent to >=1.35.47, <1.36.0. | ||
|
||
boto3~=1.35.47 | ||
Flask~=3.0.3 | ||
python-dotenv~=1.0.1 | ||
requests~=2.32.3 | ||
python-jose~=3.3.0 | ||
Flask-Cors~=5.0.0 |
Oops, something went wrong.