|
| 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 | +[](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. |
0 commit comments