Skip to content

Commit a157c5e

Browse files
authored
Merge pull request #53 from mozzy11/main
update read me and ci
2 parents 0231139 + 8731eeb commit a157c5e

5 files changed

Lines changed: 150 additions & 8 deletions

File tree

.env

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,21 @@ SSL_TRUSTSTORE_PATH=/etc/openelis-global/truststore
55
SSL_TRUSTSTORE_PASSWORD=tspass
66
SSL_KEYSTORE_PATH=/etc/openelis-global/keystore
77
SSL_KEYSTORE_PASSWORD=kspass
8+
9+
10+
11+
# Source for the proxy's nginx certs/keys mounts.
12+
# Default = the named volumes (filled by the certgen service).
13+
# In deployment, set these to a host path with your real certs, e.g.
14+
# OE_CERTS_PATH=/etc/letsencrypt/live/example.org
15+
# OE_KEYS_PATH=/etc/letsencrypt/live/example.org
16+
OE_CERTS_PATH=certs-vol
17+
OE_KEYS_PATH=keys-vol
18+
19+
# Cert/key filenames the nginx proxy looks for inside the mounts above.
20+
# Default = the self-signed files produced by the certgen service.
21+
# In deployment, set these to your real cert filenames, e.g.
22+
# OE_NGINX_CERT=fullchain.pem
23+
# OE_NGINX_KEY=privkey.pem
24+
OE_NGINX_CERT=apache-selfsigned.crt
25+
OE_NGINX_KEY=apache-selfsigned.key
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Deploy to testing.openelis-global.org
2+
3+
# WHAT IT DOES
4+
# SSHes into the testing VM and (re)deploys THIS repo's docker-compose stack
5+
# (the published :develop images). On the server it: pulls the latest repo state,
6+
# applies the testing-server cert overrides to .env, then `docker compose pull`
7+
# + `up -d`. The deploy target dir defaults to /home/ubuntu/openelis-docker
8+
# (override with the DEPLOY_PATH repo variable).
9+
#
10+
# NOTE: OpenELIS-Global-2 has its OWN "Deploy / Testing VM" workflow that runs a
11+
# dev WAR-mounted stack on the same host. Both bind 80/443 -- only one stack can
12+
# own the VM at a time. Make sure this repo's stack is the intended one before use.
13+
#
14+
# HOW IT RUNS
15+
# 1. Manually -> "Run workflow" button (workflow_dispatch)
16+
# 2. Reused by another workflow -> called with `uses:` (workflow_call)
17+
#
18+
# To auto-deploy after the image build (DIGI-UW/OpenELIS-Global-2 publish-images.yml),
19+
# add a job to that workflow that reuses this one:
20+
#
21+
# deploy-testing:
22+
# needs: publish-images
23+
# uses: DIGI-UW/openelis-docker/.github/workflows/deploy-testing.yml@main
24+
# secrets: inherit
25+
#
26+
# CREDENTIALS (reused from OpenELIS-Global-2's deploy workflow)
27+
# secret TESTING_VM_SSH_KEY DIGI-UW org-level secret (the VM's SSH key)
28+
# var TESTING_VM_USER SSH user, falls back to 'ubuntu'
29+
# Via the `uses:` path, `secrets: inherit` forwards them from the caller. For a
30+
# standalone run IN THIS REPO, the org secret's "Repository access" must include
31+
# openelis-docker (a DIGI-UW org admin can confirm/extend it).
32+
33+
on:
34+
workflow_dispatch:
35+
workflow_call:
36+
37+
# Never run two deploys against the server at the same time.
38+
concurrency:
39+
group: deploy-testing
40+
cancel-in-progress: false
41+
42+
jobs:
43+
deploy:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Deploy over SSH
47+
uses: appleboy/ssh-action@v1.0.3
48+
with:
49+
host: ${{ vars.DEPLOY_HOST || 'testing.openelis-global.org' }}
50+
username: ${{ vars.TESTING_VM_USER || 'ubuntu' }}
51+
port: ${{ vars.DEPLOY_PORT || 22 }}
52+
key: ${{ secrets.TESTING_VM_SSH_KEY }}
53+
script_stop: true
54+
envs: DEPLOY_PATH
55+
script: |
56+
set -euo pipefail
57+
58+
APP_DIR="${DEPLOY_PATH:-/home/ubuntu/openelis-docker}"
59+
REPO_URL="https://github.com/DIGI-UW/openelis-docker.git"
60+
61+
# --- fetch the latest deployment definition -----------------------
62+
if [ ! -d "$APP_DIR/.git" ]; then
63+
git clone "$REPO_URL" "$APP_DIR"
64+
fi
65+
cd "$APP_DIR"
66+
git fetch origin main
67+
git reset --hard origin/main
68+
69+
# --- apply the testing-server env overrides -----------------------
70+
# set_env KEY VALUE : replace the line if the key exists, else append it
71+
set_env() {
72+
key="$1"; val="$2"
73+
if grep -qE "^${key}=" .env; then
74+
sed -i "s|^${key}=.*|${key}=${val}|" .env
75+
else
76+
printf '%s=%s\n' "$key" "$val" >> .env
77+
fi
78+
}
79+
set_env OE_NGINX_CERT cert.crt
80+
set_env OE_NGINX_KEY cert.key
81+
set_env OE_CERTS_PATH /home/ubuntu/certs2026
82+
set_env OE_KEYS_PATH /home/ubuntu/certs2026
83+
84+
# --- pull new images and restart ----------------------------------
85+
docker compose pull
86+
docker compose up -d --remove-orphans
87+
docker image prune -f
88+
env:
89+
DEPLOY_PATH: ${{ vars.DEPLOY_PATH }}

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ Docker Compose setup for OpenELIS-Global2
33

44
You can find more information on how to set up OpenELIS at our [docs page](http://docs.openelis-global.org/)
55

6-
[![Build Status](https://github.com/I-TECH-UW/OpenELIS-Global-2/actions/workflows/ci.yml/badge.svg)](https://github.com/I-TECH-UW/OpenELIS-Global-2/actions/workflows/ci.yml)
6+
[![Backend Build](https://github.com/DIGI-UW/OpenELIS-Global-2/actions/workflows/backend.yml/badge.svg)](https://github.com/DIGI-UW/OpenELIS-Global-2/actions/workflows/backend.yml)
77

8-
[![Publish Docker Image Status](https://github.com/I-TECH-UW/OpenELIS-Global-2/actions/workflows/publish-and-test.yml/badge.svg)](https://github.com/I-TECH-UW/OpenELIS-Global-2/actions/workflows/publish-and-test.yml)
8+
[![Frontend Build](https://github.com/DIGI-UW/OpenELIS-Global-2/actions/workflows/frontend.yml/badge.svg)](https://github.com/DIGI-UW/OpenELIS-Global-2/actions/workflows/frontend.yml)
99

10-
[![Build Off Line Docker Images](https://github.com/I-TECH-UW/openelis-docker/actions/workflows/build-installer.yml/badge.svg)](https://github.com/I-TECH-UW/openelis-docker/actions/workflows/build-installer.yml)
10+
[![Publish Docker Images](https://github.com/DIGI-UW/OpenELIS-Global-2/actions/workflows/publish-images.yml/badge.svg)](https://github.com/DIGI-UW/OpenELIS-Global-2/actions/workflows/publish-images.yml)
11+
12+
[![Build Off Line Docker Images](https://github.com/DIGI-UW/openelis-docker/actions/workflows/build-installer.yml/badge.svg)](https://github.com/DIGI-UW/openelis-docker/actions/workflows/build-installer.yml)
1113

1214
## ONLINE INSTALLATION
1315

@@ -16,6 +18,32 @@ You can find more information on how to set up OpenELIS at our [docs page](http:
1618

1719
1. Update the Enviroment vaiable `ADMIN_PASSWORD` in the [.env](./.env) file for the 'admin' user
1820

21+
## Configuring the TLS Certificate (Optional)
22+
23+
By default the proxy serves the self-signed certificate generated by the `certs`
24+
service. For a real deployment you can point the proxy at your own certificate
25+
and key using four environment variables in the [.env](./.env) file:
26+
27+
| Variable | What it sets | Default |
28+
|----------|--------------|---------|
29+
| `OE_CERTS_PATH` | **Where** the certificate directory comes from — a Docker named volume by default, or a host path in deployment | `certs-vol` |
30+
| `OE_KEYS_PATH` | **Where** the private-key directory comes from | `keys-vol` |
31+
| `OE_NGINX_CERT` | **Which** certificate file (filename) nginx loads from `OE_CERTS_PATH` | `apache-selfsigned.crt` |
32+
| `OE_NGINX_KEY` | **Which** key file (filename) nginx loads from `OE_KEYS_PATH` | `apache-selfsigned.key` |
33+
34+
- A bare name (e.g. `certs-vol`) uses the Docker **named volume** filled by the
35+
`certs` service. A value containing a slash (e.g. `/home/ubuntu/certs2026`) is
36+
mounted as a **host path** instead — put your real cert/key in that directory.
37+
- `OE_NGINX_CERT` / `OE_NGINX_KEY` are the filenames *inside* those directories;
38+
nginx is rendered to load them at startup, so they must match the files present.
39+
40+
Example: serving real certs from `/home/ubuntu/certs2026/cert.crt` and `cert.key`:
41+
42+
OE_CERTS_PATH=/home/ubuntu/certs2026
43+
OE_KEYS_PATH=/home/ubuntu/certs2026
44+
OE_NGINX_CERT=cert.crt
45+
OE_NGINX_KEY=cert.key
46+
1947
### Running OpenELIS Global with docker-compose
2048
docker-compose up -d
2149

configs/nginx/nginx.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ http {
3535
listen 443 ssl default;
3636
server_name __;
3737

38-
ssl_certificate /etc/nginx/certs/apache-selfsigned.crt;
39-
ssl_certificate_key /etc/nginx/keys/apache-selfsigned.key;
38+
ssl_certificate /etc/nginx/certs/${OE_NGINX_CERT};
39+
ssl_certificate_key /etc/nginx/keys/${OE_NGINX_KEY};
4040

4141
proxy_set_header X-Forwarded-For $proxy_protocol_addr; # To forward the original client's IP address
4242
proxy_set_header X-Forwarded-Proto $scheme; # to forward the original protocol (HTTP or HTTPS)

docker-compose.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,17 @@ services:
161161
ports:
162162
- 80:80
163163
- 443:443
164+
environment:
165+
- OE_NGINX_CERT=${OE_NGINX_CERT:-apache-selfsigned.crt}
166+
- OE_NGINX_KEY=${OE_NGINX_KEY:-apache-selfsigned.key}
167+
command:
168+
- /bin/sh
169+
- -c
170+
- "envsubst '$$OE_NGINX_CERT $$OE_NGINX_KEY' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && exec nginx -g 'daemon off;'"
164171
volumes:
165-
- certs-vol:/etc/nginx/certs/
166-
- keys-vol:/etc/nginx/keys/
167-
- ./configs/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
172+
- ${OE_CERTS_PATH:-certs-vol}:/etc/nginx/certs/
173+
- ${OE_KEYS_PATH:-keys-vol}:/etc/nginx/keys/
174+
- ./configs/nginx/nginx.conf:/etc/nginx/nginx.conf.template:ro
168175
# - /KEYSTORE_PASSWORD:/etc/nginx/private/key_pass
169176
# - /etc/openelis-global/nginx.cert.pem:/etc/nginx/certs/cert.crt
170177
# - /etc/openelis-global/nginx.key.pem:/etc/nginx/certs/cert.key

0 commit comments

Comments
 (0)