Skip to content

Commit

Permalink
Merge branch 'development' of github.com:hotosm/fmtm into fix-editabl…
Browse files Browse the repository at this point in the history
…e-vector-layer
  • Loading branch information
NSUWAL123 committed Jan 16, 2024
2 parents 563c588 + 6bc5eff commit f6eecf1
Show file tree
Hide file tree
Showing 29 changed files with 190 additions and 1,211 deletions.
4 changes: 2 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"frontend":
- any: ["src/frontend/**/*", "!src/frontend/public/install-fmtm.sh"]
- "src/frontend/**/*"
"backend":
- "src/backend/**/*"
"devops":
- ".github/**/*"
- "nginx/**/*"
- "scripts/**/*"
- "src/frontend/public/install-fmtm.sh"
- "docker-*.yml"
- "**/Dockerfile"
- "**/*.dockerfile"
- "**/*entrypoint.sh"
- "Justfile"
"migration":
- "src/backend/migrations/**/*"
"documentation":
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/build_proxy_imgs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ jobs:
NGINX_TAG=${{ vars.NGINX_TAG }}
multi_arch: true

build-proxy-main-plus-script:
uses: hotosm/gh-workflows/.github/workflows/[email protected]
with:
context: nginx
build_target: main-plus-script
image_tags: |
"ghcr.io/${{ github.repository }}/proxy:main-plus-script"
extra_build_args: |
NGINX_TAG=${{ vars.NGINX_TAG }}
multi_arch: true

build-proxy-dev:
uses: hotosm/gh-workflows/.github/workflows/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
# Versioning: Commit messages & changelog
- repo: https://github.com/commitizen-tools/commitizen
rev: 3.12.0
rev: v3.13.0
hooks:
- id: commitizen
stages: [commit-msg]
Expand Down
5 changes: 0 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,8 @@ On a Linux-based machine with `bash` installed, run the script:
> However, if you run as root, a user svcfmtm will be created for you.
```bash
# Option A) If you already cloned the repo
bash src/frontend/public/install.sh

# Option B) Download the script & run
curl -L https://get.fmtm.dev -o install.sh
bash install.sh
# Alternative URL: https://fmtm.hotosm.org/install.sh

# Then follow the prompts
```
Expand Down
107 changes: 107 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Copyright (c) 2020, 2021 Humanitarian OpenStreetMap Team
#
# This file is part of FMTM.
#
# FMTM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FMTM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with FMTM. If not, see <https:#www.gnu.org/licenses/>.
#

# Builds

build-backend:
docker compose build api

build-frontend:
docker compose build ui

build: build-backend build-frontend

# Run

run:
docker compose up -d

run-without-central:
docker compose --profile no-odk up -d

run-with-josm:
docker compose \
-f docker-compose.yml \
-f josm/docker-compose.yml \
up -d

stop:
docker compose down

clean-db:
docker compose down -v

# Tests

test-backend:
docker compose run --rm api pytest

test-frontend:
docker compose run -e CI=True --rm --entrypoint='sh -c' ui 'npm run test'

test: test-backend test-frontend

# Maintenance

lint:
TAG_OVERRIDE=ci TARGET_OVERRIDE=ci docker compose run --rm --no-deps \
--volume $PWD:$PWD --workdir $PWD \
--entrypoint='sh -c' api \
'git config --global --add safe.directory $PWD \
&& pre-commit run --all-files'

bump:
TAG_OVERRIDE=ci TARGET_OVERRIDE=ci docker compose run --rm --no-deps \
--volume $PWD:$PWD --workdir $PWD \
--entrypoint='sh -c' api \
'git config --global --add safe.directory $PWD \
&& git config --global user.name svcfmtm \
&& git config --global user.email [email protected] \
&& cd src/backend \
&& cz bump --check-consistency'

# Docs

docs-rebuild: docs-clean docs-doxygen docs-uml

docs-clean:
@rm -rf docs/{apidocs,html,docbook,man} docs/packages.png docs/classes.png

docs-doxygen:
cd docs && doxygen

docs-uml:
cd docs && pyreverse -o png ../src/backend/app

docs-pdf:
# Strip any unicode out of the markdown file before converting to PDF
# FIXME
MDS := \
docs/dev/Backend.md \
docs/dev/Database-Tips.md \
docs/dev/Deployment-Flow.md \
docs/dev/Frontend.md \
docs/dev/Production.md \
docs/dev/Version-Control.md \
docs/dev/Setup.md \
docs/dev/Troubleshooting.md \
PDFS := $(MDS:.md=.pdf)
@echo "Converting $PDFS to a PDF"
@new=$(notdir $(basename $PDFS)); \
iconv -f utf-8 -t US $PDFS -c | \
pandoc $PDFS -f markdown -t pdf -s -o /tmp/$$new.pdf
61 changes: 0 additions & 61 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion contrib/josm/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
depends_on:
- josm-novnc
networks:
- fmtm-dev
- fmtm-net
- x11
ports:
- 8111:80
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ services:
FMTM_API_DOMAIN: ${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
FMTM_ODK_DOMAIN: ${FMTM_ODK_DOMAIN:-odk.${FMTM_DOMAIN}}
FMTM_S3_DOMAIN: ${FMTM_S3_DOMAIN:-s3.${FMTM_DOMAIN}}
FMTM_SCRIPT_DOMAIN: ${FMTM_SCRIPT_DOMAIN:-_}
ports:
- 80:80
- 443:443
Expand Down Expand Up @@ -244,7 +243,6 @@ services:
FMTM_API_DOMAIN: ${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
FMTM_ODK_DOMAIN: ${FMTM_ODK_DOMAIN:-odk.${FMTM_DOMAIN}}
FMTM_S3_DOMAIN: ${FMTM_S3_DOMAIN:-s3.${FMTM_DOMAIN}}
FMTM_SCRIPT_DOMAIN: ${FMTM_SCRIPT_DOMAIN:-_}
CERT_EMAIL: ${CERT_EMAIL}
ports:
- 80:80
Expand Down
4 changes: 1 addition & 3 deletions docker-compose.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ networks:

services:
proxy:
image: "ghcr.io/hotosm/fmtm/proxy:main${FMTM_SCRIPT_DOMAIN:+-plus-script}"
image: "ghcr.io/hotosm/fmtm/proxy:main"
container_name: fmtm-main
depends_on:
api:
Expand All @@ -55,7 +55,6 @@ services:
environment:
FMTM_DOMAIN: ${FMTM_DOMAIN}
FMTM_API_DOMAIN: ${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
FMTM_SCRIPT_DOMAIN: ${FMTM_SCRIPT_DOMAIN:-_}
ports:
- 80:80
- 443:443
Expand Down Expand Up @@ -158,7 +157,6 @@ services:
environment:
FMTM_DOMAIN: ${FMTM_DOMAIN}
FMTM_API_DOMAIN: ${FMTM_API_DOMAIN:-api.${FMTM_DOMAIN}}
FMTM_SCRIPT_DOMAIN: ${FMTM_SCRIPT_DOMAIN:-_}
CERT_EMAIL: ${CERT_EMAIL}
ports:
- 80:80
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ services:
image: "ghcr.io/hotosm/fmtm/backend:${TAG_OVERRIDE:-debug}"
build:
context: src/backend
target: debug
target: "${TARGET_OVERRIDE:-debug}"
args:
APP_VERSION: "${TAG_OVERRIDE:-debug}"
container_name: fmtm-api
Expand Down
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fmtm.dev
1 change: 0 additions & 1 deletion docs/dev/Production.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ your own cloud server.
```bash
curl -L https://get.fmtm.dev -o install.sh
bash install.sh
# Alternative URL: https://fmtm.hotosm.org/install.sh

# Then follow the prompts
```
Expand Down
8 changes: 0 additions & 8 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ COPY container-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY templates/cert-init/fmtm.conf.template \
templates/cert-init/api.conf.template \
templates/cert-init/script.conf.template \
/etc/nginx/templates/


Expand All @@ -122,13 +121,6 @@ COPY templates/fmtm.conf.template \



FROM main as main-plus-script
# Add install script
COPY templates/script.conf.template \
/etc/nginx/templates/



FROM main as development
# API, Frontend, ODK, S3
COPY templates/odk.conf.template \
Expand Down
11 changes: 0 additions & 11 deletions nginx/build_imgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,3 @@ docker build nginx \
if [[ -n "$PUSH_IMGS" ]]; then
docker push "ghcr.io/hotosm/fmtm/proxy:main"
fi

# Main plus script proxy
echo "Building proxy:main-plus-script"
docker build nginx \
--tag "ghcr.io/hotosm/fmtm/proxy:main-plus-script" \
--target main-plus-script \
--build-arg NGINX_TAG="${NGINX_TAG}"

if [[ -n "$PUSH_IMGS" ]]; then
docker push "ghcr.io/hotosm/fmtm/proxy:main-plus-script"
fi
10 changes: 0 additions & 10 deletions nginx/container-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,5 @@ echo "Running command: certbot --non-interactive certonly ${certbot_args[@]}"
certbot --non-interactive certonly "${certbot_args[@]}"
echo "Certificate generated under: /etc/letsencrypt/live/${FMTM_DOMAIN}/"

# Add FMTM_SCRIPT_DOMAIN if present
if [ -n "${FMTM_SCRIPT_DOMAIN}" ] && [ "${FMTM_SCRIPT_DOMAIN}" != "_" ]; then
echo
echo "FMTM_SCRIPT_DOMAIN variable set. Generating separate certificate."
certbot --non-interactive certonly \
--webroot --webroot-path=/var/www/certbot \
--email "${CERT_EMAIL}" --agree-tos --no-eff-email \
-d "${FMTM_SCRIPT_DOMAIN}"
fi

# Successful exit (stop container)
exit 0
30 changes: 0 additions & 30 deletions nginx/templates/cert-init/script.conf.template

This file was deleted.

Loading

0 comments on commit f6eecf1

Please sign in to comment.