-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Justfile
93 lines (81 loc) · 2.92 KB
/
Justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Copyright (c) 2024 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/>.
#
set dotenv-load
mod start 'contrib/just/start/Justfile'
mod stop 'contrib/just/stop/Justfile'
mod build 'contrib/just/build/Justfile'
mod test 'contrib/just/test/Justfile'
mod dotenv 'contrib/just/dotenv/Justfile'
# Run the help script
default:
@just --unstable help
# View available commands
help:
@just --unstable --list --justfile {{justfile()}}
# Run database migrations for backend
migrate:
docker compose up -d migrations
# Delete local database, S3, and ODK Central data
clean:
docker compose down -v
# Run pre-commit hooks
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'
# Increment version
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'
# Run docs website locally
docs:
@echo
@echo "\033[0;33m ############################################### \033[0m"
@echo
@echo
@echo "\033[0;34m Access the docs site on: http://localhost:55425 \033[0m"
@echo
@echo
@echo "\033[0;33m ############################################### \033[0m"
@echo
TAG_OVERRIDE=ci TARGET_OVERRIDE=ci docker compose run --rm --no-deps \
--volume $PWD:$PWD --workdir $PWD --publish 55425:3000 \
--entrypoint='sh -c' api \
'git config --global --add safe.directory $PWD \
&& mkdocs serve --dev-addr 0.0.0.0:3000'
# Mount an S3 bucket on your filesystem
mount-s3:
#!/usr/bin/env sh
fstab_entry="fmtm-data /mnt/fmtm/local fuse.s3fs _netdev,allow_other,\
use_path_request_style,passwd_file=/home/$(whoami)/s3-creds/fmtm-local,\
url=http://s3.fmtm.localhost:7050 0 0"
if ! grep -q "$fstab_entry" /etc/fstab; then
echo "Mounting local FMTM S3 permanently in /etc/fstab"
echo "$fstab_entry" | sudo tee -a /etc/fstab > /dev/null
echo
else
echo "Local FMTM S3 is already mounted"
fi