Skip to content

Commit

Permalink
Merge pull request #1 from purijs/feature/0001
Browse files Browse the repository at this point in the history
first push, github actions
  • Loading branch information
purijs authored Sep 18, 2024
2 parents 9b03545 + c00ef93 commit d9bf3c2
Show file tree
Hide file tree
Showing 13 changed files with 2,177 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# .github/workflows/run-unit-tests.yml

name: Run Unit Tests

# Trigger the workflow on push or pull request to the main branch
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v3

# Step 2: Set up Python environment
- name: Set Up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'

# Step 3: Install dependencies
- name: Install Dependencies
run: |
cd docker/backend/fastapi/
python -m pip install --upgrade pip
pip install -r requirements.txt
# Step 4: Run Unit Tests
- name: Run Unit Tests
run: |
cd docker/backend/fastapi/
python test_ci_unittests.py
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,19 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

*.parquet
*.gpkg
*.mbtiles
*.tif

# OS
*.DS_Store
Thumbs.db

# IDE
.vscode/

# Virtual environments
*.venv
.env
20 changes: 20 additions & 0 deletions data/vector/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"options": {
"paths": {
"root": "/usr/lib/node_modules/tileserver-gl/node_modules/tileserver-gl-styles",
"fonts": "fonts",
"styles": "styles",
"mbtiles": "/data",
"pmtiles": "/data"
}
},
"styles": {},
"data": {
"buildings": {
"mbtiles": "buildings.mbtiles"
},
"parcel": {
"mbtiles": "parcel_intersecting_grid.mbtiles"
}
}
}
105 changes: 105 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
version: '3.8'

services:

dozzle:
image: amir20/dozzle:latest
deploy:
mode: global
resources:
limits:
cpus: "0.25"
memory: 1G
restart_policy:
condition: on-failure
max_attempts: 2
environment:
- DOZZLE_MODE=swarm
- DOZZLE_ADDR=:9200
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- 9200:9200
networks:
- appconnector


frontend:
image: credium-fe:latest
deploy:
replicas: 1
resources:
limits:
cpus: "0.25"
memory: 1G
restart_policy:
condition: on-failure
max_attempts: 2
networks:
- appconnector
ports:
- "8081:80"

backend:
image: credium-be:latest
deploy:
replicas: 1
resources:
limits:
cpus: "1"
memory: 2G
restart_policy:
condition: on-failure
max_attempts: 2
volumes:
- ${PWD}/data:/var/task/fastapi/data
- ${PWD}/db:/var/task/fastapi/db
networks:
- appconnector
ports:
- "8080:8080"

raster-titiler:
image: ghcr.io/developmentseed/titiler:latest
environment:
- PORT=8000
- WORKERS_PER_CORE=1
- TITILER_API_CORS_ALLOW_METHODS='GET,POST'
deploy:
replicas: 1
resources:
limits:
cpus: "1"
memory: 1G
restart_policy:
condition: on-failure
max_attempts: 2
volumes:
- ${PWD}/data/raster:/data
ports:
- "8000:8000"
networks:
- appconnector

vector-tilserver:
image: vector-tileserver:latest
deploy:
replicas: 1
resources:
limits:
cpus: "1"
memory: 1G
restart_policy:
condition: on-failure
max_attempts: 2
volumes:
- ${PWD}/data/vector:/data
ports:
- "9100:9100"
networks:
- appconnector

networks:
appconnector:
driver: overlay
attachable: true
33 changes: 33 additions & 0 deletions docker/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ghcr.io/osgeo/gdal:ubuntu-small-latest

ENV TASK_ROOT=/var/task
ENV PATH="$TASK_ROOT/bin:$PATH"

RUN apt-get update && \
apt-get install -y build-essential gcc-aarch64-linux-gnu ca-certificates curl gnupg vim libasound2-dev libatk1.0-0 libc6 libcairo2 libcups2 \
libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 \
libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libnss3 \
lsb-release xdg-utils wget ca-certificates libclang-dev libgc1 libobjc4 libpq5 libxcb-xkb1 \
libxkbcommon-x11-0 libgbm-dev python3-pip python3-venv && \
python3 -m venv $TASK_ROOT && \
$TASK_ROOT/bin/pip install --upgrade pip

COPY ./fastapi/requirements.txt ${TASK_ROOT}/fastapi/requirements.txt

RUN $TASK_ROOT/bin/pip install --no-cache-dir -r ${TASK_ROOT}/fastapi/requirements.txt --break-system-packages

WORKDIR ${TASK_ROOT}

RUN mkdir ${TASK_ROOT}/fastapi/data ${TASK_ROOT}/fastapi/db

RUN groupadd -r appgroup && useradd -r -g appgroup -d ${TASK_ROOT} -s /bin/bash appuser && \
chown -R appuser:appgroup ${TASK_ROOT}

USER appuser
EXPOSE 8080

COPY ./fastapi/main.py ${TASK_ROOT}/fastapi/main.py
COPY ./fastapi/unittests.py ${TASK_ROOT}/fastapi/unittests.py

CMD ["bash", "-c", "PYTHONPATH=${TASK_ROOT}/fastapi uvicorn main:app --host 0.0.0.0 --port 8080 --log-level debug --timeout-keep-alive 300"]
Loading

0 comments on commit d9bf3c2

Please sign in to comment.