Use this mode if you want to run ESAP in Docker containers on your own machine in 'production mode'.
- this will install ESAP locally. You can ESAP-GUI in your browser at 'localhost/esap-gui'.
- there is no need to register your instance at IAM, you can use our default registration.
prerequisites
- git
- Docker & docker-compose
- curl
Installation
STEP 1 (automatic) - install_esap.sh
curl -fsSL https://git.astron.nl/astron-sdc/esap-api-gateway/-/raw/master/esap/deploy/install_esap.sh -o install_esap.sh && chmod +x install_esap.sh && ./install_esap.sh
This creates 2 directories:
~/esap_root
contains the source code
~/esap_shared
contains shared configuration and configuration databases
STEP 2 (manual configuration)
Your ESAP-GUI frontend needs to know where your ESAP-API backend is before the frontend is compiled into a Javascript bundle.
nano ~/esap_root/esap-gui/src/contexts/GlobalContext.js
Look for this snippet of code in GlobalContext.js and make sure that the api_host
of production is
set correctly.
const api_host =
process.env.NODE_ENV === "development"
? "http://localhost:5555/esap-api/"
: "http://localhost:8000/esap-api/";
Registering at IAM
A development ESAP client is already registered as a service at IAM for the 'localhost' redirect url.
But you can also choose to register your own ESAP client and get your own OIDC_RP_CLIENT_ID
and OIDC_RP_CLIENT_SECRET
. See Register at IAM for that procedure.
Fill in OIDC settings
Fill inOIDC_RP_CIENT_ID
and OIDC_RP_CLIENT_SECRET
that you received from us, or from your own IAM registration.
nano ~/esap_shared/oidc.env
OIDC_RP_CLIENT_ID=<existing-client-id>
OIDC_RP_CLIENT_SECRET=<existing-client-secret>
LOGIN_REDIRECT_URL=http://localhost/esap-gui/login
LOGOUT_REDIRECT_URL=http://localhost/esap-gui/logout
LOGIN_REDIRECT_URL_FAILURE=http://localhost/esap-gui/error
STEP 3 (automatic) - run_esap.sh
curl -fsSL https://git.astron.nl/astron-sdc/esap-api-gateway/-/raw/master/esap/deploy/run_esap.sh -o run_esap.sh && chmod +x run_esap.sh && ./run_esap.sh
This builds the frontend and spins up the Docker containers
STEP 4 (manual) - adding a superuser for the admin app
You can use the Django admin app to change the configuration of ESAP. (See the 'ESAP configuration' documentation). But you need to create a 'superuser' with admin rights for that.
Execute the following docker command to create a superuser with admin rights and follow the instructions on screen. Note that this is not your IAM account, it is recommended to create a user 'admin' for this.
docker exec -it esap_api_gateway python manage.py createsuperuser --settings=esap.settings.docker
You should now be able to login with the superuser that you just created:
- admin app:
<your_host>/esap-api/admin/
Testing:
docker container ls
should show the 2 containers
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
26439ee6c80d esap_gui:latest "/docker-entrypoint.…" 16 minutes ago Up 16 minutes 0.0.0.0:80->80/tcp esap_gui
e3d8162e444a esap_api_gateway:latest "/bin/sh -c 'exec gu…" 16 minutes ago Up 16 minutes 8000/tcp esap_api_gateway
- frontend: http://localhost/esap-gui
- backend : http://localhost:8000/esap-api/query/
Updates
If you want to update your ESAP installation then you can rerun the two script commands.
This will not override your databases and configuration in the ~/esap_shared
directory, unless you first delete them manually.
curl -fsSL https://git.astron.nl/astron-sdc/esap-api-gateway/-/raw/master/esap/deploy/install_esap.sh -o install_esap.sh && chmod +x install_esap.sh && ./install_esap.sh
curl -fsSL https://git.astron.nl/astron-sdc/esap-api-gateway/-/raw/master/esap/deploy/run_esap.sh -o run_esap.sh && chmod +x run_esap.sh && ./run_esap.sh
Shutting down
When you have finished working on ESAP, you can shut down the running system as follows:
cd ~/esap_shared
ESAP_SHARED=~/esap_shared ESAP_ROOT=~/esap_root docker-compose down