Skip to content

Commit cb72e70

Browse files
committed
feat: use new nginx-unpriviledged base image
document HTTP basic auth usage
1 parent 79ebd79 commit cb72e70

File tree

5 files changed

+39
-85
lines changed

5 files changed

+39
-85
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ volumes/core/config/oracle/wallet/*.lck
99
volumes/core/config/oracle/wallet/*.p12
1010
volumes/core/config/oracle/wallet/*.sso
1111
volumes/web_gui/nginx/certs/nginx.*
12+
volumes/web_gui/nginx/htpasswd/.htpasswd

docker-compose.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ services:
1010
depends_on:
1111
core:
1212
condition: service_started
13+
environment:
14+
- FRONTEND_BASE_URL=${FRONTEND_BASE_URL:-}
1315
volumes:
14-
- ./volumes/web_gui/nginx/templates:/etc/nginx/templates
16+
- ./volumes/web_gui/nginx/htpasswd:/etc/nginx/htpasswd
1517
- ./volumes/web_gui/nginx/certs:/etc/nginx/certs
1618
networks:
1719
- common
1820
ports:
19-
- ${EXTERNAL_HTTP_PORT}:443
21+
- ${EXTERNAL_HTTP_PORT}:8443
2022

2123
# Migrator core exposed as REST service API
2224
core:

migrator

+11-5
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,17 @@ installed_from_archive() {
254254

255255
generate_self_signed_certificate() {
256256
info "Generating self-signed TLS/SSL certificate"
257-
docker compose run --no-deps web_gui \
258-
openssl req -x509 -nodes -newkey rsa:2048 \
259-
-keyout "${NGINX_SSL_CERTIFICATE_KEY}" -out "${NGINX_SSL_CERTIFICATE}"
260-
docker compose run --no-deps web_gui \
261-
chown $UID:$(id -g) "${NGINX_SSL_CERTIFICATE_KEY}" "${NGINX_SSL_CERTIFICATE}"
257+
edition=$(print_env 'EDITION')
258+
version=$(print_env 'VERSION')
259+
docker run -it \
260+
cybertecpostgresql/cybertec_migrator-${edition}-web_gui:${version} \
261+
bash -c "openssl genrsa -out /tmp/nginx.key 4096 && cat /tmp/nginx.key" \
262+
> ./volumes/web_gui/nginx/certs/nginx.key
263+
docker run -it \
264+
--mount "type=bind,source=$(pwd)/volumes/web_gui/nginx/certs/nginx.key,target=/tmp/nginx.key" \
265+
cybertecpostgresql/cybertec_migrator-${edition}-web_gui:${version} \
266+
bash -c "openssl req -new -key /tmp/nginx.key -x509 -out /tmp/nginx.crt -days 3650 -subj \"/C=AT/ST=Lower Austria/L=Wöllersdorf/O=CYBERTEC PostgreSQL International GmbH/OU=Development/CN=cybertec.at\" && cat /tmp/nginx.crt" \
267+
> ./volumes/web_gui/nginx/certs/nginx.crt
262268
ok "Generated self-signed TLS/SSL certificate"
263269
next_step_upgrade
264270
}
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Basic Authentication
2+
3+
To enable HTTP Basic Auth, create a new file `.htpasswd`:
4+
5+
```shell
6+
touch .htpasswd
7+
```
8+
9+
To add a new user, start by adding a username (replace the example with your own username):
10+
```shell
11+
sh -c "echo -n 'john-doe:' >> ./.htpasswd"
12+
```
13+
14+
Finish the process by generating a password:
15+
```shell
16+
sh -c "openssl passwd -apr1 >> ./.htpasswd"
17+
```
18+
19+
Restart the migrator for the new users to come into effect:
20+
```shell
21+
# Within the repository root
22+
./migrator up
23+
```

volumes/web_gui/nginx/templates/default.conf.template

-78
This file was deleted.

0 commit comments

Comments
 (0)