Skip to content

Commit 97fceb3

Browse files
committed
Add docker samples
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
1 parent 5eabd19 commit 97fceb3

File tree

14 files changed

+348
-0
lines changed

14 files changed

+348
-0
lines changed

docker/examples/README.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Examples
2+
3+
* [postgres-with-volume.yml](#postgres-with-volume.yml)
4+
* [mysql-with-volume.yml](#mysql-with-volume.yml)
5+
* [derby-with-volumes-and-secrets.yml](#derby-with-volumes-and-secrets.yml)
6+
* [postgres-with-2-connect-servers-in-cluster.yml](#postgres-with-2-connect-servers-in-cluster.yml)
7+
* [play-with-docker-example.yml](#play-with-docker-example.yml)
8+
9+
------------
10+
11+
<a name="postgres-with-volume.yml"></a>
12+
### postgres-with-volume.yml
13+
14+
This stack launches Connect along with a PostgreSQL database. It also mounts a volume for the appdata folder so that the server ID / keystore file are preserved.
15+
16+
If you want you can edit the stack file and change the location of the appdata volume:
17+
18+
```yaml
19+
volumes:
20+
- ./data/volumes/appdata:/opt/connect/appdata
21+
```
22+
23+
Then use [docker-compose](https://docs.docker.com/compose/) to launch:
24+
25+
```bash
26+
docker-compose -f examples/postgres-with-volume.yml up
27+
```
28+
29+
------------
30+
31+
<a name="mysql-with-volume.yml"></a>
32+
### mysql-with-volume.yml
33+
34+
This stack launches Connect along with a MySQL database. It also mounts a volume for the appdata folder so that the server ID / keystore file are preserved.
35+
36+
If you want you can edit the stack file and change the location of the appdata volume:
37+
38+
```yaml
39+
volumes:
40+
- ./data/volumes/appdata:/opt/connect/appdata
41+
```
42+
43+
Then use [docker-compose](https://docs.docker.com/compose/) to launch:
44+
45+
```bash
46+
docker-compose -f examples/mysql-with-volume.yml up
47+
```
48+
49+
------------
50+
51+
<a name="derby-with-volumes-and-secrets.yml"></a>
52+
### derby-with-volumes-and-secrets.yml
53+
54+
This stack launches Connect using its embedded Apache Derby database. It mounts a volume for the appdata folder so that the Derby database, server ID, and keystore file are preserved. It also mounts another `custom-extensions` volume to allow additional extensions (such as our [FHIR Connector](https://www.mirthcorp.com/community/wiki/pages/viewpage.action?pageId=36504815)) to be automatically installed. This file also demonstrates how to use [Docker Secrets](https://docs.docker.com/engine/swarm/secrets/) with docker-compose.
55+
56+
If you want you can edit the stack file and change the volume/secret locations:
57+
58+
```yaml
59+
volumes:
60+
- ./data/volumes/appdata:/opt/connect/appdata
61+
- ./data/volumes/custom-extensions:/opt/connect/custom-extensions
62+
```
63+
64+
```yaml
65+
secrets:
66+
mirth_properties:
67+
file: ./data/secret.properties
68+
mcserver_vmoptions:
69+
file: ./data/secret.vmoptions
70+
```
71+
72+
To test installing an extension, you can download the [FHIR Connector](https://www.mirthcorp.com/community/wiki/pages/viewpage.action?pageId=36504815) extension and place the ZIP file into the `examples/data/volumes/custom-extensions` folder.
73+
74+
Any properties you put in the `examples/data/secret.properties` file will be merged into mirth.properties. By default this file contains:
75+
76+
```bash
77+
keystore.storepass = docker_storepass
78+
keystore.keypass = docker_keypass
79+
```
80+
81+
Any entries you put in the `examples/data/secret.vmoptions` file will be appended to the `mcserver.vmoptions` file inside the container. You can use this to set sensitive Java System properties like so:
82+
83+
```bash
84+
-Dmy.secret.property=thepassword
85+
```
86+
87+
Finally, use [docker-compose](https://docs.docker.com/compose/) to launch:
88+
89+
```bash
90+
docker-compose -f examples/derby-with-volumes-and-secrets.yml up
91+
```
92+
93+
------------
94+
95+
<a name="postgres-with-2-connect-servers-in-cluster.yml"></a>
96+
### postgres-with-2-connect-servers-in-cluster.yml
97+
98+
This stack launches two clustered Connect servers along with a PostgreSQL database. It mounts volumes for the appdata folders for both servers, and also launches a load balancer ([HAProxy](https://hub.docker.com/_/haproxy)) to forward requests to both Connect servers.
99+
100+
If you want you can edit the stack file and change the volume locations:
101+
102+
```yaml
103+
volumes:
104+
- ./data/volumes/appdata1:/opt/connect/appdata
105+
...
106+
volumes:
107+
- ./data/volumes/appdata2:/opt/connect/appdata
108+
```
109+
110+
Then use [docker-compose](https://docs.docker.com/compose/) to launch:
111+
112+
```bash
113+
docker-compose -f examples/postgres-with-2-connect-servers-in-cluster.yml up
114+
```
115+
116+
Once both servers come online, you can login using the Administrator GUI to the load balanced 8443 port, or you can login specifically to the `mc1` node on the 8441 port, or the `mc2` node on the 8442 port.
117+
118+
The environment also load balances on port 9001, so you can test by creating an HTTP Listener channel on that port and deploying it on both servers. Then you can send requests to `http://localhost:9001` on your local workstation, and you should see that the requests get round-robin load balanced to both servers.
119+
120+
------------
121+
122+
<a name="play-with-docker-example.yml"></a>
123+
### play-with-docker-example.yml
124+
125+
This example file can be used to launch a Connect instance and PostgreSQL database using the [Play With Docker](https://github.com/play-with-docker/play-with-docker) framework. Just click the button below to launch:
126+
127+
[![Try in PWD](https://raw.githubusercontent.com/play-with-docker/stacks/master/assets/images/button.png)](http://play-with-docker.com/?stack=https://raw.githubusercontent.com/nextgenhealthcare/connect-docker/master/examples/play-with-docker-example.yml)
128+
129+
Note that in order to access the 8080/8443 ports from your workstation, follow [their guide](https://github.com/play-with-docker/play-with-docker#how-can-i-connect-to-a-published-port-from-the-outside-world) to format the URL correctly. When you login via the Administrator GUI, use port 443 on the end instead of 8443.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
keystore.storepass = docker_storepass
2+
keystore.keypass = docker_keypass

docker/examples/data/secret.vmoptions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Dmy.secret.property=thepassword

docker/examples/data/volumes/appdata/.keep

Whitespace-only changes.

docker/examples/data/volumes/appdata1/.keep

Whitespace-only changes.

docker/examples/data/volumes/appdata2/.keep

Whitespace-only changes.

docker/examples/data/volumes/custom-extensions/.keep

Whitespace-only changes.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
defaults
2+
mode tcp
3+
option log-health-checks
4+
option redispatch
5+
retries 3
6+
timeout queue 1m
7+
timeout connect 10s
8+
timeout client 1m
9+
timeout server 1m
10+
timeout check 10s
11+
maxconn 3000
12+
13+
backend mcserver-http
14+
balance roundrobin
15+
server mc1-http mc1:8080 check
16+
server mc2-http mc2:8080 check
17+
18+
frontend mc-http
19+
bind *:8080
20+
default_backend mcserver-http
21+
22+
backend mcserver-https
23+
balance roundrobin
24+
server mc1-https mc1:8443 check
25+
server mc2-https mc2:8443 check
26+
27+
frontend mc-https
28+
bind *:8443
29+
default_backend mcserver-https
30+
31+
backend mcserver-9001
32+
balance roundrobin
33+
server mc1-9001 mc1:9001 check
34+
server mc2-9001 mc2:9001 check
35+
36+
frontend mc-9001
37+
bind *:9001
38+
default_backend mcserver-9001
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: "3.1"
2+
services:
3+
mc:
4+
image: ghcr.io/mgaffigan/oie:latest
5+
environment:
6+
- VMOPTIONS=-Xmx512m
7+
volumes:
8+
- ./data/volumes/appdata:/opt/connect/appdata
9+
- ./data/volumes/custom-extensions:/opt/connect/custom-extensions
10+
secrets:
11+
- mirth_properties
12+
- mcserver_vmoptions
13+
ports:
14+
- 8080:8080/tcp
15+
- 8443:8443/tcp
16+
17+
secrets:
18+
mirth_properties:
19+
file: ./data/secret.properties
20+
mcserver_vmoptions:
21+
file: ./data/secret.vmoptions

docker/examples/example.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DATABASE=postgres
2+
DATABASE_URL=jdbc:postgresql://host.docker.internal:5432/mirthdb
3+
DATABASE_MAX_CONNECTIONS=20
4+
DATABASE_USERNAME=mirthdb
5+
DATABASE_PASSWORD=mirthdb
6+
KEYSTORE_STOREPASS=docker_storepass
7+
KEYSTORE_KEYPASS=docker_keypass
8+
VMOPTIONS=-Xmx512m

0 commit comments

Comments
 (0)