1 ### Insane Development Docker Environment ###
2 The Insane Development Docker Environment will load up about 37 separate dockers and allow you to
3 test almost any version of mysql/mariadb/php, however it is not nearly as easy to use as the above Easy Development
4 Docker Environment. See below for instructions of use of the Insane Development Docker Environment.
8 **Step 1.** Install [git](https://git-scm.com/downloads),
9 [docker](https://www.docker.com/get-docker) and
10 [compose](https://docs.docker.com/compose/install/) for your system. Also, make
11 sure you have a [fork](https://help.github.com/articles/fork-a-repo/) of OpenEMR.
12 - If you want to set up the base services(e.g. git, docker, docker-compose, openemr-cmd) easily, please try [openemr-env-installer](https://github.com/openemr/openemr-devops/tree/master/utilities/openemr-env-installer)
13 - If you want to troubleshoot with the below steps easier, please also [install openemr-cmd](https://github.com/openemr/openemr-devops/tree/master/utilities/openemr-cmd) for your system
14 - If you want to monitor and easily manage the docker environment, please also [install openemr-monitor](https://github.com/openemr/openemr-devops/tree/master/utilities/openemr-monitor) and [install portainer](https://github.com/openemr/openemr-devops/tree/master/utilities/portainer) for your system
15 - If you want to migrator the running docker environment, please try [openemr-env-migrator](https://github.com/openemr/openemr-devops/tree/master/utilities/openemr-env-migrator)
17 **Step 2.** Start OpenEMR.
19 $ git clone git@github.com:YOUR_USERNAME/openemr.git
21 There are 2 different schools of thought on where to run the docker from.
22 - Option 1. Run the docker from within your git repository.(this is also where you edit
23 scripts in your editor)
25 $ cd openemr/docker/development-insane
26 $ docker-compose up -d
28 - Option 2. Run the docker from a separate directory that is synchronized with your git
29 repository. For example, if used /var/www/openemr.
31 $ cd /var/www/openemr/docker/development-insane
32 $ docker-compose up -d
34 - At this time, I highly recommend option 2 since running OpenEMR will change
35 scripts, add files, add cache files, thus making it very tough to track your
36 code change. Modern GUI Editors support this; for example PHPStorm can be
37 set up to do this every time you save a script via
38 [PHP Storm Customizing Upload](https://www.jetbrains.com/help/phpstorm/customizing-upload.html).
39 - Option 2 also allows support to quickly change branches on a repository to
40 develop/test other code. This is done by first running a command or script
41 to delete and replace the synchronized directory (ie. remove the /var/www/openemr
42 directory) and then restart the development docker (see below for how to do this)
44 **Step 3.** Open up OpenEMR in the latest Chrome or Firefox! You have many
45 options to choose from:
46 - http://localhost:8080 (with Alpine 3.12 (Apache and PHP 7.3))
47 - http://localhost:8081 (with Alpine 3.15 (Apache and PHP 7.4))
48 - http://localhost:8082 (with Alpine 3.15 (Apache and PHP 8.0))
49 - http://localhost:8083 (with Alpine 3.17 (Apache and PHP 8.1))
50 - http://localhost:8084 (with Alpine 3.18 (Apache and PHP 8.2))
51 - http://localhost:8085 (with Alpine Edge (Apache and now PHP 8.2))
52 - http://localhost:8090 (with Alpine 3.12 (Apache and PHP 7.3) with redis)
53 - http://localhost:8091 (with Alpine 3.15 (Apache and PHP 7.4) with redis)
54 - http://localhost:8092 (with Alpine 3.15 (Apache and PHP 8.0) with redis)
55 - http://localhost:8093 (with Alpine 3.17 (Apache and PHP 8.1) with redis)
56 - http://localhost:8094 (with Alpine 3.18 (Apache and PHP 8.2) with redis)
57 - http://localhost:8095 (with Alpine Edge (Apache and now PHP 8.2) with redis)
58 - http://localhost:8100 (with Nginx and PHP-FPM 7.3)
59 - http://localhost:8101 (with Nginx and PHP-FPM 7.4)
60 - http://localhost:8102 (with Nginx and PHP-FPM 8.0)
61 - http://localhost:8103 (with Nginx and PHP-FPM 8.1)
62 - http://localhost:8104 (with Nginx and PHP-FPM 8.2)
63 - http://localhost:8105 (with Nginx and PHP-FPM 8.3)
64 - http://localhost:8150 (with Nginx and PHP-FPM 7.3 with redis)
65 - http://localhost:8151 (with Nginx and PHP-FPM 7.4 with redis)
66 - http://localhost:8152 (with Nginx and PHP-FPM 8.0 with redis)
67 - http://localhost:8153 (with Nginx and PHP-FPM 8.1 with redis)
68 - http://localhost:8154 (with Nginx and PHP-FPM 8.2 with redis)
69 - http://localhost:8155 (with Nginx and PHP-FPM 8.3 with redis)
70 - https://localhost:9080 with SSL and Alpine 3.12 (with Apache and PHP 7.3)
71 - https://localhost:9081 with SSL and Alpine 3.15 (with Apache and PHP 7.4)
72 - https://localhost:9082 with SSL and Alpine 3.15 (with Apache and PHP 8.0)
73 - https://localhost:9083 with SSL and Alpine 3.17 (with Apache and PHP 8.1)
74 - https://localhost:9084 with SSL and Alpine 3.18 (with Apache and PHP 8.2)
75 - https://localhost:9085 with SSL and Alpine Edge (with Apache and now PHP 8.2)
76 - https://localhost:9090 with SSL and Alpine 3.12 (with Apache and PHP 7.3 with redis)
77 - https://localhost:9091 with SSL and Alpine 3.15 (with Apache and PHP 7.4 with redis)
78 - https://localhost:9092 with SSL and Alpine 3.15 (with Apache and PHP 8.0 with redis)
79 - https://localhost:9093 with SSL and Alpine 3.17 (with Apache and PHP 8.1 with redis)
80 - https://localhost:9094 with SSL and Alpine 3.18 (with Apache and PHP 8.2 with redis)
81 - https://localhost:9095 with SSL and Alpine Edge (with Apache and now PHP 8.2 with redis)
82 - https://localhost:9100 with SSL (with Nginx and PHP-FPM 7.3)
83 - https://localhost:9101 with SSL (with Nginx and PHP-FPM 7.4)
84 - https://localhost:9102 with SSL (with Nginx and PHP-FPM 8.0)
85 - https://localhost:9103 with SSL (with Nginx and PHP-FPM 8.1)
86 - https://localhost:9104 with SSL (with Nginx and PHP-FPM 8.2)
87 - https://localhost:9105 with SSL (with Nginx and PHP-FPM 8.3)
88 - https://localhost:9150 with SSL (with Nginx and PHP-FPM 7.3 with redis)
89 - https://localhost:9151 with SSL (with Nginx and PHP-FPM 7.4 with redis)
90 - https://localhost:9152 with SSL (with Nginx and PHP-FPM 8.0 with redis)
91 - https://localhost:9153 with SSL (with Nginx and PHP-FPM 8.1 with redis)
92 - https://localhost:9154 with SSL (with Nginx and PHP-FPM 8.2 with redis)
93 - https://localhost:9155 with SSL (with Nginx and PHP-FPM 8.3 with redis)
95 **Step 4.** Setup up OpenEMR. The first time you run OpenEMR (and whenever you clear and replace your
96 synchronized openemr directory and restart the development docker). On the main
98 - for `Server Host`, use either `mariadb` or `mariadb-ssl` or `mysql` or `mariadb-old` or `mariadb-very-old` or
99 `mariadb-very-very-old` or `mariadb-very-very-very-old` or `mysql-old` (you have all
100 mariadb/mysql/mariadb-\*/mysql-\* dockers ready to go to make testing either one easy;
101 `mysql` is version 8.0; `mysql-old` is version 5.7;
102 `mariadb` is version 10.11; `mariadb-ssl` is version 10.11 with support for ssl; `mariadb-old` is version 10.6; `mariadb-very-old` is
103 version 10.5; `mariadb-very-very-old` is version 10.4; `mariadb-very-very-very-old` is version 10.3)
104 - for `Root Pass`, use `root`
105 - for `User Hostname`, use `%`
107 #### Stop/Clean Out Dockers
108 There are frequently times where you will want to remove the dockers and start anew.
109 For example, when you change github branches and start testing/developing on a
110 different github branch. This is done by first running a command or script
111 to delete and replace the synchronized directory (ie. remove the /var/www/openemr
112 directory) and then restart the development docker:
114 docker-compose down -v
118 #### Updating Dockers
119 To ensure you are using the most recent dockers, recommend running below set of commands intermittently:
121 docker pull openemr/openemr:flex-edge
122 docker pull openemr/openemr:flex-3.18
123 docker pull openemr/openemr:flex-3.17
124 docker pull openemr/openemr:flex-3.15
125 docker pull openemr/openemr:flex-3.15-8
126 docker pull openemr/openemr:flex-3.12
127 docker pull openemr/dev-php-fpm:8.3
128 docker pull openemr/dev-php-fpm:8.2
129 docker pull openemr/dev-php-fpm:8.1
130 docker pull openemr/dev-php-fpm:8.0
131 docker pull openemr/dev-php-fpm:7.4
132 docker pull openemr/dev-php-fpm:7.3
133 docker pull openemr/dev-php-fpm:8.3-redis
134 docker pull openemr/dev-php-fpm:8.2-redis
135 docker pull openemr/dev-php-fpm:8.1-redis
136 docker pull openemr/dev-php-fpm:8.0-redis
137 docker pull openemr/dev-php-fpm:7.4-redis
138 docker pull openemr/dev-php-fpm:7.3-redis
139 docker pull openemr/dev-nginx
140 docker pull mariadb:10.11
141 docker pull mariadb:10.6
142 docker pull mariadb:10.5
143 docker pull mariadb:10.4
144 docker pull mariadb:10.3
146 docker pull mysql:5.7
147 docker pull phpmyadmin/phpmyadmin
149 docker pull jodogne/orthanc-plugins
150 docker pull openemr/dev-ldap:insane
152 docker pull ibmcom/ibm-fhir-server
158 ##### Examine Containers
160 Run `$ docker ps` to see the OpenEMR and MySQL containers in the following format:
163 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
164 21919d2661bf openemr/dev-nginx "nginx -g 'daemon ..." 13 minutes ago Up 13 minutes 0.0.0.0:8100->80/tcp, 0.0.0.0:8101->81/tcp, 0.0.0.0:8102->82/tcp, 0.0.0.0:8103->83/tcp, 0.0.0.0:8104->84/tcp, 0.0.0.0:8105->85/tcp, 0.0.0.0:8106->86/tcp, 0.0.0.0:8150->90/tcp, 0.0.0.0:8151->91/tcp, 0.0.0.0:8152->92/tcp, 0.0.0.0:8153->93/tcp, 0.0.0.0:8154->94/tcp, 0.0.0.0:8155->95/tcp, 0.0.0.0:8156->96/tcp, 0.0.0.0:9100->440/tcp, 0.0.0.0:9101->441/tcp, 0.0.0.0:9102->442/tcp, 0.0.0.0:9103->443/tcp, 0.0.0.0:9104->444/tcp, 0.0.0.0:9105->445/tcp, 0.0.0.0:9106->446/tcp, 0.0.0.0:9150->450/tcp, 0.0.0.0:9151->451/tcp, 0.0.0.0:9152->452/tcp, 0.0.0.0:9153->453/tcp, 0.0.0.0:9154->454/tcp, 0.0.0.0:9155->455/tcp, 0.0.0.0:9156->456/tcp docker_nginx_1
165 f9b3844b16b4 openemr/openemr:flex-3.10 "./run_openemr.sh" 14 minutes ago Up 13 minutes 0.0.0.0:8087->80/tcp, 0.0.0.0:9087->443/tcp docker_openemr-7-3-redis-310_1
166 33561685efcf openemr/dev-php-fpm:5.6-redis "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-5-6-redis_1
167 84c1b8514556 mariadb:10.4 "docker-entrypoint..." 14 minutes ago Up 13 minutes 0.0.0.0:8210->3306/tcp docker_mariadb_1
168 6d55960d12ee couchdb "tini -- /docker-e..." 14 minutes ago Up 13 minutes 0.0.0.0:5984->5984/tcp, 4369/tcp, 9100/tcp, 0.0.0.0:6984->6984/tcp docker_couchdb_1
169 217b51921613 mariadb:10.2 "docker-entrypoint..." 14 minutes ago Up 14 minutes 3306/tcp docker_mariadb-very-old_1
170 715782908b7b mysql:8 "docker-entrypoint..." 14 minutes ago Up 13 minutes 33060/tcp, 0.0.0.0:8220->3306/tcp docker_mysql_1
171 621069bc0bba redis "docker-entrypoint..." 14 minutes ago Up 14 minutes 6379/tcp docker_redis_1
172 48d1998f19a2 openemr/openemr:flex-3.10 "./run_openemr.sh" 14 minutes ago Up 13 minutes 0.0.0.0:8082->80/tcp, 0.0.0.0:9082->443/tcp docker_openemr-7-3-310_1
173 ca615ad4a021 ibmcom/ibm-fhir-server "/opt/ol/helpers/r..." 14 minutes ago Up 13 minutes 9080/tcp, 0.0.0.0:9443->9443/tcp docker_fhir_1
174 2cfba3013358 openemr/openemr:flex-3.11 "./run_openemr.sh" 14 minutes ago Up 13 minutes 0.0.0.0:8083->80/tcp, 0.0.0.0:9083->443/tcp docker_openemr-7-3-311_1
175 534aa394a3f6 openemr/openemr:flex-3.9 "./run_openemr.sh" 14 minutes ago Up 14 minutes 0.0.0.0:8081->80/tcp, 0.0.0.0:9081->443/tcp docker_openemr-7-2_1
176 5833b84a791c openemr/dev-php-fpm:8.0-redis "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-8-0-redis_1
177 9922f2b50e4d openemr/dev-php-fpm:7.2-redis "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-2-redis_1
178 d2fe53bb3177 openemr/dev-php-fpm:7.1-redis "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-1-redis_1
179 b5918e344113 openemr/openemr:flex-edge "./run_openemr.sh" 14 minutes ago Up 14 minutes 0.0.0.0:8089->80/tcp, 0.0.0.0:9089->443/tcp docker_openemr-edge-redis_1
180 653184128fce openemr/dev-php-fpm:7.2 "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-2_1
181 97e664c8f555 jodogne/orthanc-plugins "Orthanc /etc/orth..." 14 minutes ago Up 13 minutes 0.0.0.0:4242->4242/tcp, 0.0.0.0:8042->8042/tcp docker_orthanc_1
182 56e2e2bec925 osixia/openldap "/container/tool/run" 14 minutes ago Up 14 minutes 389/tcp, 636/tcp docker_openldap_1
183 f5009868ab52 openemr/dev-php-fpm:7.0-redis "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-0-redis_1
184 e3fbde1539ab openemr/dev-php-fpm:8.0 "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-8-0_1
185 95fbfe06c740 mariadb:10.5 "docker-entrypoint..." 14 minutes ago Up 14 minutes 3306/tcp docker_mariadb-dev_1
186 07c1fb11e3a1 openemr/dev-php-fpm:7.4 "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-4_1
187 9382e3f1b8be mariadb:10.1 "docker-entrypoint..." 14 minutes ago Up 14 minutes 3306/tcp docker_mariadb-very-very-old_1
188 33ba9403b218 mariadb:10.3 "docker-entrypoint..." 14 minutes ago Up 14 minutes 3306/tcp docker_mariadb-old_1
189 6e0bd890cd30 openemr/openemr:flex-3.7 "./run_openemr.sh" 14 minutes ago Up 14 minutes 0.0.0.0:8080->80/tcp, 0.0.0.0:9080->443/tcp docker_openemr-7-1_1
190 a81e7e2cc6c2 openemr/dev-php-fpm:7.1 "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-1_1
191 77b9a1c21867 openemr/dev-php-fpm:5.6 "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-5-6_1
192 3f9c03757d16 mysql:5.7 "docker-entrypoint..." 14 minutes ago Up 14 minutes 3306/tcp, 33060/tcp docker_mysql-old_1
193 76e9cef725cd openemr/dev-php-fpm:7.0 "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-0_1
194 2f6e268e7411 openemr/openemr:flex-3.9 "./run_openemr.sh" 14 minutes ago Up 13 minutes 0.0.0.0:8086->80/tcp, 0.0.0.0:9086->443/tcp docker_openemr-7-2-redis_1
195 e55ea8b540d8 openemr/openemr:flex-edge "./run_openemr.sh" 14 minutes ago Up 14 minutes 0.0.0.0:8084->80/tcp, 0.0.0.0:9084->443/tcp docker_openemr-edge_1
196 3a95311da546 openemr/openemr:flex-3.11 "./run_openemr.sh" 14 minutes ago Up 13 minutes 0.0.0.0:8088->80/tcp, 0.0.0.0:9088->443/tcp docker_openemr-7-3-redis-311_1
197 8706b8495b41 openemr/dev-php-fpm:7.4-redis "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-4-redis_1
198 31df6d708395 phpmyadmin/phpmyadmin "/docker-entrypoin..." 14 minutes ago Up 14 minutes 0.0.0.0:8200->80/tcp docker_phpmyadmin_1
199 b044c08bf02b openemr/openemr:flex-3.7 "./run_openemr.sh" 14 minutes ago Up 14 minutes 0.0.0.0:8085->80/tcp, 0.0.0.0:9085->443/tcp docker_openemr-7-1-redis_1
200 ba8362e6ecdc openemr/dev-php-fpm:7.3 "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-3_1
201 16eebdbfb00f openemr/dev-php-fpm:7.3-redis "docker-php-entryp..." 14 minutes ago Up 14 minutes 9000/tcp docker_dev-php-fpm-7-3-redis_1
202 24c8a1614707 mysql:5.6 "docker-entrypoint..." 14 minutes ago Up 14 minutes 3306/tcp docker_mysql-very-old_1
204 - Note the `NAMES` column is extremely important and how you run docker commands
205 on specific containers. For example, to go into a shell script in the
206 `openemr_openemr-7-2_1` container, would use:
208 docker exec -it openemr_openemr-7-2_1 bash
214 $ docker exec -it <container_NAME> bash
217 ##### MySQL Client Access
218 There are 2 options for gui access:
219 - GUI can be accessed via the phpMyAdmin at http://localhost:8200 for all sql dockers
220 - Or you can directly connect to port 8210 (`mariadb` server only) or 8220 (`mysql` server only) via your favorite sql tool (Mysql Workbench etc.). Note this option is limited to the `mysql` and `mariadb` servers.
221 If you are interested in using the MySQL client line as opposed to a GUI program, execute the following (password is passed in/is simple because this is for local development purposes):
224 $ docker exec -it <container_NAME> mysql -u root --password=root openemr
227 ##### Apache Error Log Tail
230 $ docker exec -it <container_NAME> tail -f /var/log/apache2/error.log
232 ...if you want the `access.log`, you can use this approach as well.
234 ##### Recommended Development Setup
236 While there is no officially recommended toolset for programming OpenEMR,
237 many in the community have found
238 [PhpStorm](https://www.jetbrains.com/phpstorm/),
239 [Sublime Text](https://www.sublimetext.com/),
240 and [Vim](http://www.vim.org/) to be useful for coding. For database work,
241 [MySQL Workbench](https://dev.mysql.com/downloads/workbench/) or PhpMyAdmin
242 offers a smooth experience.
244 Many helpful tips and development "rules of thumb" can be found by reviewing
245 [OpenEMR Development](http://open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#Development).
246 Remember that learning to code against a very large and complex system is not a
247 task that will be completed over night. Feel free to post on
248 [the development forums](https://community.open-emr.org/c/openemr-development)
249 if you have any questions after reviewing the wiki.
253 See the `docker-compose.yml` file in the contrib/util/docker directory for port details.
255 All host machine ports can be changed by editing the `docker-compose.yml` file.
256 Host ports differ from the internal container ports by default to avoid conflicts
257 services potentially running on the host machine (a web server such as Nginx,
258 Tomcat, or Apache2 could be installed on the host machine that makes use of
259 port 80, for instance).
261 ##### Additional Build Tools
263 Programmers looking to use OpenEMR's and [Composer and NPM](http://www.open-emr.org/wiki/index.php//Composer_and_NPM)
264 build tools can simply `bash` into the OpenEMR container and use them as expected.
267 In OpenEMR, CouchDB is an option for the patients document storage. For this reason, a CouchDB
268 docker is included in this OpenEMR docker development environment. You can visit the CouchDB
269 GUI directly via http://localhost:5984/_utils/ or https://localhost:6984/_utils/ with
270 username `admin` and password `password`. You can configure OpenEMR to use this CouchDB
271 docker for patient document storage in OpenEMR at Administration->Globals->Documents:
272 - Document Storage Method->CouchDB
273 - CouchDB HostName->couchdb
274 - CouchDB UserName->admin
275 - CouchDB Password->password
277 - CouchDB Database can be set to any name you want
280 In OpenEMR, LDAP is an option for user authentication. You can configure OpenEMR to use the
281 OpenLDAP docker patient authentication in OpenEMR at Administration->Globals->Security:
282 - LDAP - Server Name or URI : ldap://openldap:389
283 - LDAP - Distinguished Name of User : cn={login},dc=example,dc=org
284 - LDAP - Login Exclusions : (place whatever your admin login is; warning, do not use "admin" for your openemr admin login)
286 (note that using 'cn' rather than 'uid' in this case for the distinguished name since the default openldap docker hasn't assigned a uid to the "admin" user)
288 Then create a user named “admin” in OpenEMR. When you log in as that user, the password is “admin”.
290 #### Ongoing Development
293 Developers are currently working on integrating the Orthanc PACS server into OpenEMR. This
294 feature is currently under development. Although it is not yet integrated with OpenEMR yet,
295 you can connect to the Orthanc application gui via http://localhost:8042/ with username `orthanc`
296 and password `orthanc`. The nginx docker has also been set up to work as a reverse proxy
297 with orthanc to allow ongoing development via http://localhost:8090/orthanc/ (Note this reverse
298 proxy is still a work in progress)
301 A FHIR server is included to make it easier to test on a bona fide FHIR server as developers
302 work towards supporting FHIR via OpenEMR's API. The FHIR server is docker from
303 https://hub.docker.com/r/ibmcom/ibm-fhir-server and see there for instructions of use.
305 #### The Insane Docker Development Environment is a work in progress
307 This is an ongoing work in progress and feel free to join the super exciting
308 OpenEMR container projects. Feel free to post PR's to update the
309 docker-compose.yml script or this documentation. Also feel free to post
310 updates on the openemr/openemr:flex or openemr/openemr:flex-edge dockers
311 which can be found at
312 https://github.com/openemr/openemr-devops/tree/master/docker/openemr
314 #### Stuff that needs fixing
315 1. The reverse proxy for orthanc