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

use environment variables on runtime #22

Open
wants to merge 91 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
b68790f
add front-end
bastyen Jun 20, 2024
e1bb784
improve ssr render
bastyen Jun 21, 2024
1035b0f
add environments
bastyen Jun 21, 2024
5c666e2
add api url to environment
bastyen Jun 21, 2024
da587cf
add observation detail
bastyen Jun 24, 2024
298b75d
add img to observation marker
bastyen Jun 24, 2024
5494c15
handle observation popup cursor
bastyen Jun 24, 2024
b5b1a97
add backend and global structure
submarcos Jun 24, 2024
22bc4dd
Merge pull request #5 from PnEcrins/add_backend_and_other_stuff
submarcos Jun 24, 2024
5cc5443
add filter dialog
bastyen Jun 25, 2024
f4cd24b
remove useless map init
bastyen Jun 25, 2024
d2825d3
prettier write
bastyen Jun 25, 2024
bfddaf1
add observations list on synthesis interface
bastyen Jun 25, 2024
e574a1b
Add quality checks and tests (#6)
submarcos Jun 25, 2024
48dfa22
handle synthesis interface filter
bastyen Jun 26, 2024
412faf9
Merge pull request #8 from PnEcrins/handle-synthesis-interface-filter
bastyen Jun 26, 2024
e64fb6b
Add release CI (#7)
submarcos Jun 26, 2024
2d47cf7
display detail observation
bastyen Jun 28, 2024
5022839
API endpoints and dynamic responses (#9)
submarcos Jul 1, 2024
a739638
handle custom theme
bastyen Jul 1, 2024
41d93ec
Merge pull request #10 from PnEcrins/ui-developement
bastyen Jul 2, 2024
ead4b5e
add service worker
bastyen Jul 2, 2024
39c1b64
Merge pull request #11 from PnEcrins/pwa
bastyen Jul 2, 2024
ddb9309
add first photo in observation API lists, change thumbnails to JPEG/7…
submarcos Jul 2, 2024
9912a60
add UUID field on user model (#13)
submarcos Jul 2, 2024
c2d9ae7
hotfix add user UUID in serializer
submarcos Jul 2, 2024
a6f6695
Improve install (#14)
submarcos Jul 3, 2024
58a7628
handle offline observations
bastyen Jul 5, 2024
72b3f98
change to SVGFileField
submarcos Jul 3, 2024
75a392d
manage category tree, areas and api settings
submarcos Jul 4, 2024
dafdc34
add tests
submarcos Jul 5, 2024
526c1b8
add preview
submarcos Jul 5, 2024
59d47d9
allow load settings from custom.py file
submarcos Jul 5, 2024
261a070
update translations
submarcos Jul 5, 2024
4f52547
handle offline tiles
bastyen Jul 5, 2024
da5e162
add loader during download and delete offline data
bastyen Jul 5, 2024
212d766
disable close on loader dialog backdrop
bastyen Jul 5, 2024
1c778f6
update translations
submarcos Jul 8, 2024
774ec5f
fix tests
submarcos Jul 8, 2024
94828ea
fix add user
submarcos Jul 8, 2024
6940e53
improve filtering
submarcos Jul 8, 2024
f3dda16
add name to observations
submarcos Jul 8, 2024
53e9101
add s3 backend doc and requirements
submarcos Jul 8, 2024
3647bdb
edit types
bastyen Jul 8, 2024
6a286c1
handle offline area bbox
bastyen Jul 8, 2024
8ab793f
Merge pull request #18 from PnEcrins/offline
bastyen Jul 8, 2024
2344baa
separate sign up endpoint
submarcos Jul 9, 2024
48e36f2
add api services
bastyen Jul 9, 2024
1cb7933
add django-cors-headers
submarcos Jul 9, 2024
61e6730
disable rate limits
submarcos Jul 10, 2024
6167018
revert bug
submarcos Jul 10, 2024
a1db8c1
add min and max zoom to area serializer
submarcos Jul 10, 2024
ee16e54
add anonymous nickname
submarcos Jul 10, 2024
2cc78a5
add translations
submarcos Jul 10, 2024
261e1dc
add translations
submarcos Jul 10, 2024
5c3bf40
add translations
submarcos Jul 10, 2024
424e19f
add translations
submarcos Jul 10, 2024
2c2c2e1
fix
submarcos Jul 10, 2024
152039a
use uuid in endpoints
submarcos Jul 10, 2024
fb8d55d
get data from api
bastyen Jul 10, 2024
335379b
fix category order in admin
submarcos Jul 12, 2024
526e85f
add media endpoints
submarcos Jul 12, 2024
a660161
add media endpoints
submarcos Jul 12, 2024
c7e15e4
add media endpoints
submarcos Jul 12, 2024
6741664
fix media endpoints
submarcos Jul 12, 2024
b9beaf6
fix thumbnail as read only in API
submarcos Jul 12, 2024
9de9c9d
fix thumbnail as read only in API
submarcos Jul 12, 2024
b691559
fix thumbnail as read only in API
submarcos Jul 12, 2024
a5f9df3
fix thumbnail as read only in API
submarcos Jul 12, 2024
e83c2f4
fix thumbnail as read only in API
submarcos Jul 12, 2024
e1982cb
Update Frontend launch doc
camillemonchicourt Jul 12, 2024
f24c22b
observation name is not required
submarcos Jul 15, 2024
a0a1030
observation name is not required
submarcos Jul 15, 2024
59f91d8
manage base map url in backend
submarcos Jul 15, 2024
e6f7ab1
allow empty observation name
submarcos Jul 15, 2024
e52383b
send observation
bastyen Jul 15, 2024
c012def
fix tests
submarcos Jul 16, 2024
212228b
fix tests
submarcos Jul 16, 2024
08aa562
send photos
bastyen Jul 16, 2024
1b4d6c6
handle offline settings
bastyen Jul 16, 2024
22ad4dd
handle map settings
bastyen Jul 17, 2024
ec64b95
add filters to observation API endpoint
submarcos Jul 17, 2024
334b30d
improve get observations
bastyen Jul 17, 2024
27faceb
add learn more and legal notice pages
bastyen Jul 18, 2024
e843689
prettier
bastyen Jul 18, 2024
d01954d
edit environment
bastyen Jul 18, 2024
348ba06
improve new observation init
bastyen Jul 18, 2024
ccd9d7b
add .env
bastyen Jul 18, 2024
277497a
Merge pull request #19 from PnEcrins/use-api
bastyen Jul 18, 2024
b7b23a7
add default .env
bastyen Jul 18, 2024
f84de1f
use environment variables on runtime
bastyen Jul 18, 2024
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
121 changes: 121 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
ARG NODE_MAJOR_VERSION=20

FROM ubuntu:noble AS base

ARG NODE_MAJOR_VERSION

ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC

RUN mkdir -p /app/backend app/front-end/dist && chown -R ubuntu:ubuntu /app
WORKDIR /app

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get -qq update && apt-get -qq install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
python3.12 \
binutils \
gdal-bin \
libproj-dev \
libpq5 \
nano \
gettext

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR_VERSION}.x | bash - && \
apt-get -qq install -y nodejs

COPY .docker/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY .docker/update.sh /usr/local/bin/rga-update

ENTRYPOINT ["/bin/sh", "-e", "/usr/local/bin/entrypoint.sh"]

FROM base AS build

ENV NODE_ENV=development
ARG NODE_MAJOR_VERSION

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get -qq update && apt-get -qq install -y --no-install-recommends \
git \
python3.12-dev \
python3.12-venv \
build-essential \
libpq-dev

USER ubuntu

COPY --chown=ubuntu:ubuntu front-end/ /app/front-end

WORKDIR /app/front-end

RUN npm ci --no-audit

WORKDIR /app

RUN --mount=type=cache,target=/home/ubuntu/.cache/pip,sharing=locked python3.12 -m venv /app/venv && \
/app/venv/bin/pip install --upgrade pip wheel setuptools
COPY backend/requirements.txt /app/requirements.txt
RUN --mount=type=cache,target=/home/ubuntu/.cache/pip,sharing=locked \
/app/venv/bin/pip install -r /app/requirements.txt

FROM build AS dev

COPY backend/dev-requirements.txt /app/dev-requirements.txt
RUN --mount=type=cache,target=/home/ubuntu/.cache/pip,sharing=locked,uid=1,gid=1 \
/app/venv/bin/pip install -r /app/dev-requirements.txt

WORKDIR /app/backend

CMD ["/app/venv/bin/python", "manage.py", "runserver", "0.0.0.0:8000"]

FROM base AS prod

ENV NODE_ENV=production

WORKDIR /app/backend

USER root
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get -qq update && apt-get -y full-upgrade

USER ubuntu

COPY --chown=ubuntu:ubuntu front-end/package-lock.json /app/front-end/package-lock.json
COPY --chown=ubuntu:ubuntu front-end/package.json /app/front-end/package.json

WORKDIR /app/front-end

RUN npm ci --no-audit --only=production

COPY --chown=ubuntu:ubuntu --from=build /app/venv /app/venv
COPY --chown=ubuntu:ubuntu --from=build /app/front-end/dist /app/front-end/dist
COPY --chown=ubuntu:ubuntu backend/project/ /app/backend/project
COPY --chown=ubuntu:ubuntu backend/manage.py /app/backend/manage.py

WORKDIR /app/backend

RUN SECRET_KEY=temp /app/venv/bin/python ./manage.py compilemessages

CMD ["gunicorn", "project.wsgi:application", "--bind", "0.0.0.0:8000"]

FROM base AS front-dev

WORKDIR /app/front-end

USER ubuntu

COPY --chown=ubuntu:ubuntu front-end/ /app/front-end
COPY --chown=ubuntu:ubuntu --from=build /app/front-end/node_modules /app/front-end/node_modules

ENTRYPOINT [""]

CMD ["npx", "ng", "serve", "--host", "0.0.0.0"]
1 change: 1 addition & 0 deletions .docker/app.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TZ=Europe/Paris
3 changes: 3 additions & 0 deletions .docker/db.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
7 changes: 7 additions & 0 deletions .docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

# Activate venv
. /app/venv/bin/activate

# exec
exec "$@"
7 changes: 7 additions & 0 deletions .docker/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

# Migrate database
python ./manage.py migrate --noinput

# Collect static files
python ./manage.py collectstatic --noinput
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/front-end/node_modules/
/front-end/.vscode/
6 changes: 6 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UID=1000
GID=1000
NGINX_PORT=8080
BACKEND_PORT=8000
NODE_PORT=3000
POSTGRES_PORT=5432
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "pip"
directory: "backend/" # Location of package manifests
schedule:
interval: "weekly"
ignore:
- dependency-name: "django"
update-types: [ "version-update:semver-major", "version-update:semver-minor" ] # only allow auto update on django bug and security fixes

- package-ecosystem: "npm"
directory: "front-end/" # Location of package manifests
schedule:
interval: "weekly"
22 changes: 22 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
changelog:
categories:
- title: 🎉 Features
labels:
- '*'
exclude:
labels:
- dependencies
- Bug
- documentation

- title: 🛠 Bug fixes
labels:
- 'Bug'

- title: 📘 Documentation
labels:
- documentation

- title: ⤴ Dependencies
labels:
- dependencies
116 changes: 116 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Quality checks

on:
pull_request:
push:
branches:
- master
- main
- next

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
DEBIAN_FRONTEND: noninteractive

jobs:
flake8:
name: Python Flake8 check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: ./backend/.python-version

- name: Install flake8
working-directory: ./backend
run: |
pip install flake8 -c dev-requirements.txt

- name: Flake8
working-directory: ./backend
run: |
flake8 project

isort:
name: Python iSort check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: ./backend/.python-version

- name: Install isort
working-directory: ./backend
run: |
pip install isort -c dev-requirements.txt

- name: iSort
working-directory: ./backend
run: |
isort -c project

black:
name: Python Black check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: ./backend/.python-version

- name: Install black
working-directory: ./backend
run: |
pip install black -c dev-requirements.txt

- name: black
working-directory: ./backend
run: |
black --check project

prettier:
name: JS Prettier check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ./front-end/.nvmrc
cache: 'npm'
cache-dependency-path: ./front-end/.nvmrc

- name: Install node dependencies
working-directory: ./front-end
run: |
npm ci --no-audit

- name: Prettier check
working-directory: ./front-end
run: |
npm run format:check

type:
name: JS Type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ./front-end/.nvmrc
cache: 'npm'
cache-dependency-path: ./front-end/.nvmrc

- name: Install node dependencies
working-directory: ./front-end
run: |
npm ci --no-audit

- name: Type check
working-directory: ./front-end
run: |
npm run type:check
Loading