Skip to content

Commit c145099

Browse files
committed
add custom SSL configuration page
1 parent 1a430be commit c145099

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

pages/data-visualization/install-and-connect.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ Configure Memgraph Lab using the following environment variables when running it
261261
| `QUICK_CONNECT_MG_IS_ENCRYPTED` | Turn SSL on/off for quick connect | `boolean` | `false` |
262262
| `PORT` | Lab app default listening port | `integer` | `3000` |
263263
| `REQUEST_BODY_LIMIT_MB` | Limit for request body size in MB | `integer` | `20` |
264+
| `SSL_IS_ENABLED` | Enable or disable SSL | `boolean` | `false` |
265+
| `SSL_CERT_PATH` | Path to SSL certificate to be used | `string` | `./ssl/cert.pem` |
266+
| `SSL_KEY_PATH` | Path to SSL key to be used | `string` | `./ssl/key.pem` |
264267
| `STORAGE_MG_HOST` | `(Enterprise only)` Memgraph host for the Lab remote storage | `string` | |
265268
| `STORAGE_MG_PORT` | `(Enterprise only)` Memgraph port for the Lab remote storage | `number` | |
266269
| `STORAGE_MG_IS_ENCRYPTED` | `(Enterprise only)` Memgraph SSL on/off for the Lab remote storage | `boolean` | |
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
title: Custom SSL certificates
3+
description: Use your own SSL certificate to use Memgraph Lab with HTTPS protocol.
4+
---
5+
6+
## Instantiating Memgraph Lab with Custom SSL Certificate
7+
8+
Memgraph Lab supports using custom SSL certificates, ensuring secure communication over HTTPS. To set up
9+
SSL on Memgraph Lab you will need to configure a Dockerfile using a valid SSL certificate.
10+
11+
### Options for Generating SSL Certificates
12+
13+
You have several options for generating SSL certificates:
14+
15+
#### OpenSSL
16+
OpenSSL is a widely used tool for generating SSL certificates. You can create a self-signed certificate using the following commands:
17+
18+
1. Generate a private key:
19+
```bash
20+
openssl genrsa -out key.pem 2048
21+
```
22+
23+
2. Generate a self-signed certificate:
24+
```bash
25+
openssl req -new -x509 -key key.pem -out cert.pem -days 365
26+
```
27+
28+
However, this option has an expiration date and is not signed by a publicly trusted
29+
[certificate authority](https://en.wikipedia.org/wiki/Certificate_authority), which means
30+
you will most likely receive a security warning from your browser while using it.
31+
32+
#### Let's Encrypt
33+
[Let's Encrypt](https://letsencrypt.org/) is a free, automated, and open certificate authority
34+
that provides SSL certificates. You can use tools like Certbot to obtain and install certificates.
35+
To use Let's Encrypt:
36+
37+
1. Install Certbot.
38+
2. Run Certbot to obtain your certificates:
39+
```bash
40+
sudo certbot certonly --standalone -d yourdomain.com
41+
```
42+
43+
This will generate your SSL certificate and key, typically located in
44+
`/etc/letsencrypt/live/yourdomain.com/`.
45+
46+
### Dockerfile setup
47+
48+
To run Memgraph Lab with custom SSL certificates, you need to create a
49+
Dockerfile that specifies how to build the Docker image with your certificates.
50+
51+
You will need to set the `SSL_CERT_PATH` and `SSL_KEY_PATH` environment variables
52+
to override the default `./ssl/` path used by Lab running in the container to
53+
determine the SSL certificate location. After that, you should copy your certificates
54+
(located in the `ssl` folder at the same location as your `Dockerfile`, for example)
55+
into the container at the specified path.
56+
57+
#### Example Dockerfile
58+
```docker
59+
FROM memgraph/lab:latest
60+
61+
# Environment variables
62+
ENV SSL_IS_ENABLED=true
63+
ENV SSL_CERT_PATH=./myssl/cert.pem
64+
ENV SSL_KEY_PATH=./myssl/key.pem
65+
66+
# COPY source_on_your_machine destination_in_container
67+
COPY ssl/ ./myssl/
68+
69+
EXPOSE 3000
70+
```
71+
72+
#### Building and Running the Docker Container
73+
74+
1. **Create the SSL Directory**: Make sure your SSL certificate and key are placed
75+
in a directory specified as `COPY` source in your Dockerfile.
76+
77+
2. **Build the Docker Image**: Run the following command to build your Docker image:
78+
`docker build -t memgraph-lab-ssl .`
79+
80+
3. **Run the Docker Container**: Start the container using the following command:
81+
`docker run -p 3000:3000 memgraph-lab-ssl`
82+
83+
4. **Access Memgraph Lab**: You can now access Memgraph Lab in your web browser at
84+
`https://localhost:3000`. Ensure to configure your browser to trust the self-signed
85+
certificate if you are using one.

0 commit comments

Comments
 (0)