forked from DIRACGrid/diracx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_local.sh
executable file
·31 lines (20 loc) · 978 Bytes
/
run_local.sh
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
#!/usr/bin/env bash
### Runs a local uvicorn server with the default configuration
set -euo pipefail
IFS=$'\n\t'
tmp_dir=$(mktemp -d)
mkdir -p "${tmp_dir}/signing-key" "${tmp_dir}/cs_store/"
ssh-keygen -P "" -t rsa -b 4096 -m PEM -f "${tmp_dir}/signing-key/rs256.key"
diracx internal generate-cs "${tmp_dir}/cs_store/initialRepo" --vo=diracAdmin --user-group=admin --idp-url=runlocal.diracx.invalid
export DIRACX_SERVICE_CONFIG_BACKEND_URL="git+file://${tmp_dir}/cs_store/initialRepo"
export DIRACX_DB_URL_AUTHDB="sqlite+aiosqlite:///:memory:"
export DIRACX_DB_URL_JOBDB="sqlite+aiosqlite:///:memory:"
export DIRACX_SERVICE_AUTH_TOKEN_KEY="file://${tmp_dir}/signing-key/rs256.key"
export DIRACX_SERVICE_AUTH_ALLOWED_REDIRECTS='["http://'$(hostname| tr -s '[:upper:]' '[:lower:]')':8000/docs/oauth2-redirect"]'
uvicorn --factory diracx.routers:create_app --reload
function cleanup(){
trap - SIGTERM;
echo "Cleaning up";
rm -rf "${tmp_dir}"
}
trap "cleanup" EXIT