This docker setup is designed for users of ApiOpenStudio on a local machine or a single server, and allows full https
traffic through a Traefik reverse proxy for Core and Admin. It is suitable for local development and
small-medium projects in production. It removes the need to deploy Admin and the Admin GUI on separate servers. It uses
the ApiOpenStudio, ApiOpenStudio Admin, Traefik
and MariaDB docker images.
Clone the apiopenstudio_reverse_proxy repository:
GitHub:
git clone git@github.com:naala89/apiopenstudio_reverse_proxy.git
GitLab:
git clone git@gitlab.com:apiopenstudio/apiopenstudio_reverse_proxy.git
Install mkcert
, for documentation, see mkcert.
Generate new keys using the following bash commands:
cd apiopenstudio_reverse_proxy
mkcert -cert-file certs/localhost.crt -key-file certs/localhost.key "*.docker.localhost"
cp "$(mkcert -CAROOT)/rootCA.pem" certs/ca.crt
Add the following to your /etc/hosts
file:
127.0.0.1 docker.localhost
See mkcert guide
Save your certificate key and certificate somewhere safe on your server, and update your .env
to point to the
directory containing the certificates, e.g.:
SSL_CERT_DIR=/path/to/cert/dir
Update the following entries to point to the correct domains:
http.routers.traefik.tls.domains.*.main
http.routers.traefik.tls.domains.*.sans
Update the following entries to point to the correct filenames (the path to the files should remain /etc/certs/
):
tls.certificates.*.certFile
tls.certificates.*.keyFile
Copy the example config files:
cp example.env .env
cp example.settings.api.yml settings.api.yml
cp example.settings.admin.yml settings.admin.yml
sudo chmod 660 .env settings.api.yml settings.admin.yml
sudo chgrp 33 settings.api.yml settings.admin.yml
Update the values in the Database section:
MYSQL_ROOT_PASSWORD
MYSQL_DATABASE
MYSQL_USER
MYSQL_PASSWORD
Update the values in the URLs:
API_URL
(without the https://
prefix)ADMIN_URL
(without the https://
prefix)Ensure that you have the correct image tags in:
API_IMAGE_TAG
ADMIN_IMAGE_TAG
Update the following values:
db.root_password
(same value as MYSQL_ROOT_PASSWORD
in .env
)db.username
(same value as MYSQL_USER
in .env
)db.password
(same value as MYSQL_PASSWORD
in .env
)api.url
(same value as API_URL
in .env
)api.jwt_issuer
(same as api.url
)api.jwt_permitted_for
(same as api.url
)Update the following values:
admin.url
(same value as ADMIN_URL
in .env
)Create the docker network and start the images
docker network create api_network
docker compose up -d
Install ApiOpenStudio Core:
docker exec -it apiopenstudio-api bash
./install.sh
exit
Install ApiOpenStudio Admin:
docker exec -it apiopenstudio-admin bash
./install.sh
exit
API URL: https://<API_URL>
Admin URL: https://<ADMIN_URL>
Traefik admin page is available on <API_URL>:8080