Skip to content

Commit c2e6e69

Browse files
committed
Sso deployment tutorial:
- reorder setup and start docker containers - Added new section about deployment of sso - added new variables related to servers deployment
1 parent d976c6e commit c2e6e69

File tree

2 files changed

+76
-8
lines changed

2 files changed

+76
-8
lines changed

src/server/environment/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,11 @@ Your webmaps won’t display the default background map unless we enable them on
152152
Alternatively, you can set up your own background map.
153153
:::
154154

155+
## Single Sign-On (SSO)
156+
<ServerType type="EE" />
155157

158+
| Variable name | Type | Default | Description |
159+
|--------------------------|----------|-------------------------------|--------------------------------|
160+
| `SSO_ENABLED` | boolean | `false` | Flag to enable SSO in Mergin Maps |
161+
| `SSO_SERVER_URL` | string | `http://localhost:5225` | Public URL of the SSO server. This URL should be accessible from the internet. |
162+
| `SSO_SERVER_API_KEY` | string | `` | API key used to authenticate requests to the SSO serice. |

src/server/install/index.md

Lines changed: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,19 @@ cd deployment/community
4646
cd deployment/enterprise
4747
```
4848

49-
### Start docker containers
50-
51-
Provided that `docker` and `docker-compose` are installed on your host, running <MainPlatformName /> stack should be as simple as running `docker-compose`. However, before doing that you would need to [configure](../environment/) your server setup via environment variables in `.prod.env` file.
52-
If you have not created this file yet, please do so from the provided `.env.template` file provided.
49+
### Setup environment
50+
51+
Now tweak deployment settings by modifying environment variables. You have to fix all variables marked as required in this list of [environment variables](../environment/). However, before doing that you would need to setup environment variables in `.prod.env` file.
52+
If you have not created this file yet, please do so from the provided `.env.template` file.
5353

5454
```shell
5555
cp .env.template .prod.env
5656
```
5757

58+
### Start docker containers
59+
60+
Provided that `docker` and `docker-compose` are installed on your host, running <MainPlatformName /> stack should be as simple as running `docker-compose`.
61+
5862
Once configured, you can run:
5963
```shell
6064
# For community edition
@@ -85,11 +89,66 @@ $ docker exec merginmaps-server flask user create <username> <password> --is-adm
8589
```
8690
:::
8791

88-
### Setup environment
89-
90-
Now tweak deployment settings by modifying environment variables. You have to fix all variables marked as required in this list of [environment variables](../environment/). Some of the most common issues with custom deployments are listed in the [troubleshoot](../troubleshoot/) section.
92+
## Deployment of Single Sign On (SSO)
93+
<ServerType type="EE" />
94+
95+
TTo enable SSO in <MainPlatformName />, ensure that you have the following environment variables set in your `.prod.env` file:
96+
97+
```shell
98+
SSO_ENABLED=True
99+
SSO_SERVER_URL=<PUBLIC URL OF SSO SERVER>
100+
```
101+
102+
The <MainPlatformName /> server is integrated with the most commonly used SAML and OIDC identity providers via the [Ory Polis](https://www.ory.sh/docs/polis) service. To run the Ory Polis stack, you need to provide environment variables in the `.sso.env` file. In the <GitHubRepo id="MerginMaps/server/blob/master/deployment/enterprise" desc="deployment folder for the enterprise edition" />, you can find the .sso.env.template file with all the required variables and their default values. Use the provided script to automatically pre-generate the `.sso.env` file with all the necessary variables.
103+
104+
```shell
105+
cd deployment/enterprise/sso
106+
./sso-init.sh
107+
```
108+
109+
The script will also pre-generate the `SSO_SERVER_API_KEY` variable the <MainPlatformName /> server. This variable is used to authenticate the <MainPlatformName /> server with Ory Polis. If you created the .sso.env file manually, you need to set this variable to match one of the `JACKSON_API_KEYS`.
110+
111+
Pay close attention to these environment variables and change their default values: `NEXTAUTH_ADMIN_CREDENTIALS`, `RETRACED_ADMIN_ROOT_TOKEN`, `NEXTAUTH_ACL`. To set up your connection with a SAML application (e.g Google SAML or Entra), fill in the `SAML_AUDIENCE` variable with a domain name. More details [here](https://www.ory.sh/docs/polis/deploy/env-variables#saml_audience).
91112

92-
### Test deployment
113+
:::tip Production deployment
114+
We recommend editing the `.sso.env` file manually and generating your own secrets and certificates for Ory Polis.
115+
:::
116+
117+
If you want to configure the Ory Polis service to run on its own domain in production (e.g., `sso.example.com`), you need to add this domain to the following variables:
118+
119+
* `EXTERNAL_URL=https://sso.example.com`
120+
* `NEXTAUTH_URL=https://sso.example.com`
121+
* `SSO_SERVER_URL=https://sso.example.com`
122+
123+
:::tip <MainPlatformName /> and Ory Polis communication
124+
If your <MainPlatformName /> server is running without a connection to the publicly available Ory Polis `SSO_SERVER_URL`, you can set internal IP or domain names (e.g. `http://sso:5225`) in the following variables to ensure communication: `SSO_SERVER_INTERNAL_URL=http://sso:5225` and `SSO_SERVER_API_URL=http://sso:5225`.
125+
:::
126+
127+
### Start the SSO stack
128+
129+
To run the SSO stack, you need to have a running <MainPlatformName /> server - see previous section about [deployment](#deployment).
130+
131+
Mount the `deployment/enterprise/sso/sso-nginx.conf` file to the `merginmaps-proxy` container in the `docker-compose.yml` file:
132+
133+
```yaml
134+
volumes:
135+
- ./sso/sso-nginx.conf:/etc/nginx/templates/sso.conf.template
136+
```
137+
138+
Then restart or reload the configuration in the `merginmaps-proxy` container and start the SSO stack:
139+
140+
```shell
141+
docker compose -f docker-compose.sso.yml up -d
142+
```
143+
144+
If you follow previous steps, the admin panel and authorization server for Ory Polis will be available at `http://localhost:8081`.
145+
146+
:::tip Domain for SSO Service
147+
We recommend running the Ory Polis server on a separate domain or subdomain to make it accessible to your users. The `deployment/enterprise/sso/sso-nginx.conf` file provides a reverse proxy configuration for running in a local environment. For your production deployment, use HTTPS to serve the SSO service. See the ssl-sso-nginx.conf file in the <GitHubRepo id="MerginMaps/server/blob/master/deployment/" desc="deployment folder" />.
148+
:::
149+
150+
151+
## Test deployment
93152

94153
In order to test your deployment there are some utility commands to perform basic checks.
95154

@@ -128,3 +187,5 @@ By default, email notifications are disabled, so output will be similar to this:
128187
```
129188

130189
To enable them, set variable `MAIL_SUPPRESS_SEND` in accordance to above and fill all `MAIL_*` related variables with your company SMTP server configuration.
190+
191+
Some of the most common issues with custom deployments are listed in the [troubleshoot](../troubleshoot/) section.

0 commit comments

Comments
 (0)