Skip to content

Commit 3d72ac8

Browse files
jesdynfkojiromike
andauthored
pick up new docker-compose standards (openemr#483)
Co-authored-by: Michael A. Smith <michael@smith-li.com>
1 parent 82df513 commit 3d72ac8

9 files changed

Lines changed: 36 additions & 30 deletions

File tree

packages/express/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ In a couple of minutes, once OpenEMR has finished the final setup procedures, it
3131
### General
3232

3333
* Need access to the containers? Connect to user `ubuntu`, sudo to root, and...
34-
* Apache: `docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") /bin/sh`
35-
* MySQL: `docker exec -it $(docker ps | grep mysql | cut -f 1 -d " ") /bin/bash`
34+
* Apache: `docker compose exec openemr /bin/sh`
35+
* MySQL: `docker compose exec mysql /bin/bash`
3636
* Visit container volume: `docker volume ls`, `cd $(docker volume inspect <volume_name> | jq -r ".[0].Mountpoint")`
3737

3838
#### Set Local Timezone
3939

4040
1. See http://php.net/manual/en/timezones.php for the PHP timezone for your region.
4141
2. `sudo bash`
42-
3. `docker exec $(docker ps | grep _openemr | cut -f 1 -d " ") sed -i 's^;date.timezone\ =^date.timezone = <your timezone>^' /etc/php7/php.ini`
43-
4. `docker restart $(docker ps | grep _openemr | cut -f 1 -d " ")`
42+
3. `docker compose exec openemr sed -i 's^;date.timezone\ =^date.timezone = <your timezone>^' /etc/php7/php.ini`
43+
4. `docker compose restart openemr`
4444

4545
### HIPAA Compliance
4646

packages/express/ami/ami-rekey.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,24 @@ if [[ -f /etc/appliance-unlocked ]]; then
3333
fi
3434

3535
# wait a while for services to start
36-
until docker container ls | grep openemr/openemr >& /dev/null
36+
# shellcheck disable=SC2312
37+
until docker container ls | grep openemr/openemr -q
3738
do
3839
sleep 5
3940
done
4041

41-
until docker top $(docker ps | grep _openemr | cut -f 1 -d " ") | grep httpd &> /dev/null
42+
# shellcheck disable=SC2312
43+
until docker top "$(docker ps | grep -- -openemr | cut -f 1 -d " ")" | grep -q httpd
4244
do
4345
sleep 3
4446
done
4547

4648
# reset password
47-
docker exec $(docker ps | grep _openemr | cut -f 1 -d " ") /root/unlock_admin.sh $(curl http://169.254.169.254/latest/meta-data/instance-id)
49+
# shellcheck disable=SC2312
50+
docker compose exec openemr /root/unlock_admin.sh "$(curl http://169.254.169.254/latest/meta-data/instance-id)"
4851

4952
# reset SSL
50-
docker exec $(docker ps | grep _openemr | cut -f 1 -d " ") /bin/sh -c 'rm -f /etc/ssl/private/* /etc/ssl/docker-selfsigned-configured'
53+
docker compose exec openemr /bin/sh -c 'rm -f /etc/ssl/private/* /etc/ssl/docker-selfsigned-configured'
5154
docker restart lightsail_openemr_1
5255

5356
# let's never speak of this again

packages/launchpad/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ Follow our [Getting Started Guide](https://www.open-emr.org/wiki/index.php/Googl
1717
### General
1818

1919
* Need access to the containers? Connect to user `ubuntu`, sudo to root, and...
20-
* Apache: `docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") /bin/sh`
21-
* MySQL: `docker exec -it $(docker ps | grep mysql | cut -f 1 -d " ") /bin/bash`
20+
* Apache: `docker compose exec openemr /bin/sh`
21+
* MySQL: `docker compose exec mysql /bin/bash`
2222
* Visit container volume: `docker volume ls`, `cd $(docker volume inspect <volume_name> | jq -r ".[0].Mountpoint")`
2323

2424
#### Set Local Timezone
2525

2626
1. See http://php.net/manual/en/timezones.php for the PHP timezone for your region.
2727
2. `sudo bash`
28-
3. `docker exec $(docker ps | grep _openemr | cut -f 1 -d " ") sed -i 's^;date.timezone\ =^date.timezone = <your timezone>^' /etc/php7/php.ini`
29-
4. `docker restart $(docker ps | grep _openemr | cut -f 1 -d " ")`
28+
3. `docker compose exec openemr sed -i 's^;date.timezone\ =^date.timezone = <your timezone>^' /etc/php7/php.ini`
29+
4. `docker compose restart openemr`
3030

3131
### HIPAA Compliance
3232

packages/launchpad/vm/vm-rekey.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ fi
3636
sleep 15
3737

3838
# reset password
39-
docker exec $(docker ps | grep _openemr | cut -f 1 -d " ") /root/unlock_admin.sh $(curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/openemr_admin_password)
39+
# shellcheck disable=SC2312
40+
docker compose exec openemr /root/unlock_admin.sh "$(curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/openemr_admin_password)"
4041

4142
# reset SSL
42-
docker exec $(docker ps | grep _openemr | cut -f 1 -d " ") /bin/sh -c 'rm -rf /etc/ssl/private/*'
43+
docker compose exec openemr /bin/sh -c 'rm -rf /etc/ssl/private/*'
4344
docker restart lightsail_openemr_1
4445

4546
# let's never speak of this again

packages/lightsail/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ To install, run the same launch script, make sure you're provided inbound access
5050
* You will need network access, don't try to build from a private IP without NAT egress.
5151
* Check the process list, make sure `auto_configure.php` isn't running before you attempt to log in.
5252
* Need access to the containers? Log into root, and...
53-
* Apache: `docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") /bin/sh`
53+
* Apache: `docker exec -it $(docker ps | grep -- -openemr | cut -f 1 -d " ") /bin/sh`
5454
* MySQL: `docker exec -it $(docker ps | grep mysql | cut -f 1 -d " ") /bin/bash`
5555
* Visit container volume: `docker volume ls`, `cd $(docker volume inspect <volume_name> | jq -r ".[0].Mountpoint")`
5656
* Run a quick backup? `/etc/cron.daily/duplicity-backups` as root.
@@ -103,7 +103,7 @@ If you're seeking to install a feature release (to upgrade from `5.0.0` to `5.0.
103103
#!/bin/sh
104104
105105
PATCHFILE=5-0-1-Patch-4.zip
106-
OE_INSTANCE=$(docker ps | grep _openemr | cut -f 1 -d " ")
106+
OE_INSTANCE=$(docker ps | grep -- -openemr | cut -f 1 -d " ")
107107
108108
/etc/cron.daily/duplicity-backups
109109
# running OpenEMR Standard? don't forget to make an RDS snapshot

packages/lightsail/ingestion.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@
88
# Three: You'll want a /lot/ of room to unpack. An eight-gig instance won't cut it.
99

1010
mkdir /tmp/backup-ingestion
11-
cd /tmp/backup-ingestion
12-
tar -xf $1 -C /tmp/backup-ingestion/ --no-same-owner
11+
cd /tmp/backup-ingestion || exit 1
12+
tar -xf "$1" -C /tmp/backup-ingestion/ --no-same-owner
1313

14-
DOCKERID=$(docker ps | grep _openemr | cut -f 1 -d " ")
14+
# shellcheck disable=2312
15+
DOCKERID=$(docker ps | grep -- -openemr | cut -f 1 -d " ")
1516

1617
# retrieve site
1718
mkdir webroot
1819
tar -zxf openemr.tar.gz -C webroot
1920
rm openemr.tar.gz
2021
find webroot -type d -name 'node_modules' -exec rm -rf {} +
21-
docker cp ${DOCKERID}:/var/www/localhost/htdocs/openemr/sites/default/sqlconf.php webroot/sites/default
22-
docker cp webroot ${DOCKERID}:/tmp/oe-recovery
22+
docker cp "${DOCKERID}:/var/www/localhost/htdocs/openemr/sites/default/sqlconf.php" webroot/sites/default
23+
docker cp webroot "${DOCKERID}:/tmp/oe-recovery"
2324

2425
# straighten out internal permissions
25-
docker exec -i $(docker ps | grep _openemr | cut -f 1 -d " ") /bin/sh -s << "EOF"
26+
docker exec -i "${DOCKERID}" /bin/sh -s << "EOF"
2627
cd /var/www/localhost/htdocs/openemr/sites
2728
chown -R apache:root default-recovery
2829
chmod -R 400 default-recovery
@@ -35,13 +36,14 @@ EOF
3536

3637
# restore database
3738
gzip -d openemr.sql.gz
38-
echo 'USE openemr;' | cat - openemr.sql | docker exec -i ${DOCKERID} /bin/sh -c 'mysql -h"$MYSQL_HOST" -u"$MYSQL_USER" -p"$MYSQL_PASS"'
39+
# shellcheck disable=2312
40+
echo 'USE openemr;' | cat - openemr.sql | docker exec -i "${DOCKERID}" /bin/sh -c 'mysql -h"$MYSQL_HOST" -u"$MYSQL_USER" -p"$MYSQL_PASS"'
3941
rm openemr.sql
4042

4143
# swift kick to PHP
42-
docker restart ${DOCKERID}
44+
docker restart "${DOCKERID}"
4345

44-
cd /root
46+
cd /root || exit 1
4547
rm -rf /tmp/backup-ingestion
4648

4749
echo Restore operation complete!

packages/lightsail/patch.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Script to be run:
4545
# Note that you may be copying over your own custom files so BEWARE!
4646
# For multi-site also uncomment the 3 commented docker exec lines below.
4747
48-
OE_INSTANCE=$(docker ps | grep _openemr | cut -f 1 -d " ")
48+
OE_INSTANCE=$(docker ps | grep -- -openemr | cut -f 1 -d " ")
4949
#docker exec -it "$OE_INSTANCE" sh -c 'curl -L https://raw.githubusercontent.com/openemr/openemr/v7_0_0_2/admin.php > /var/www/localhost/htdocs/openemr/admin.php'
5050
docker exec -it "$OE_INSTANCE" sh -c 'curl -L https://raw.githubusercontent.com/openemr/openemr/v7_0_0_2/sql_patch.php > /var/www/localhost/htdocs/openemr/sql_patch.php'
5151
docker exec -it "$OE_INSTANCE" sh -c 'curl -L https://www.open-emr.org/patch/7-0-0-Patch-2.zip > /var/www/localhost/htdocs/openemr/7-0-0-Patch-2.zip'
@@ -81,7 +81,7 @@ Create a cleanup script to delete sensitive scripts.
8181
/etc/cron.daily/duplicity-backups
8282
8383
#delete upgrade files that have served their purpose
84-
OE_INSTANCE=$(docker ps | grep _openemr | cut -f 1 -d " ")
84+
OE_INSTANCE=$(docker ps | grep -- -openemr | cut -f 1 -d " ")
8585
docker exec "$OE_INSTANCE" rm -f /var/www/localhost/htdocs/openemr/admin.php /var/www/localhost/htdocs/openemr/sql_patch.php /var/www/localhost/htdocs/openemr/7-0-0-Patch-2.zip
8686
8787
# comment below line to avoid deleting the patch script created above

packages/lightsail/upgrade.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ sed -i 's/5.0.0/5.0.1/' docker-compose.yml
7575
#!/bin/sh
7676
7777
# retrieve files deleted for security
78-
OE_INSTANCE=$(docker ps | grep _openemr | cut -f 1 -d " ")
78+
OE_INSTANCE=$(docker ps | grep -- -openemr | cut -f 1 -d " ")
7979
docker exec -it $OE_INSTANCE sh -c 'curl -L https://raw.githubusercontent.com/openemr/openemr/v5_0_1/sql_upgrade.php > /var/www/localhost/htdocs/openemr/sql_upgrade.php'
8080
docker exec -it $OE_INSTANCE sh -c 'curl -L https://raw.githubusercontent.com/openemr/openemr/v5_0_1/acl_upgrade.php > /var/www/localhost/htdocs/openemr/acl_upgrade.php'
8181
docker exec $OE_INSTANCE chown apache:root /var/www/localhost/htdocs/openemr/sql_upgrade.php /var/www/localhost/htdocs/openemr/acl_upgrade.php
@@ -97,6 +97,6 @@ Navigate to `http://<your-instance>/sql_upgrade.php` and select `5.0.0`.
9797
/etc/cron.daily/duplicity-backups
9898
9999
#delete upgrade files that have served their purpose
100-
OE_INSTANCE=$(docker ps | grep _openemr | cut -f 1 -d " ")
100+
OE_INSTANCE=$(docker ps | grep -- -openemr | cut -f 1 -d " ")
101101
docker exec $OE_INSTANCE rm -f /var/www/localhost/htdocs/openemr/sql_upgrade.php /var/www/localhost/htdocs/openemr/acl_upgrade.php
102102
```

packages/standard/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Administration
88

9-
* Access the OpenEMR container: `sudo -i -- sh -c 'docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") /bin/sh'`
9+
* Access the OpenEMR container: `sudo -i -- sh -c 'docker exec -it $(docker ps | grep -- -openemr | cut -f 1 -d " ") /bin/sh'`
1010
* Visit container volume: `docker volume ls`, `cd $(docker volume inspect <volume_name> | jq -r ".[0].Mountpoint")`
1111
* Open mysql shell
1212
1. Ssh into the EC2.

0 commit comments

Comments
 (0)