shihjay2 / nosh2

NOSH ChartingSystem is an electronic health record system designed exclusively for doctors and patients. This is a new mobile-friendly version that is now based off of the Laravel PHP framework and jQuery. NOSH has FHIR, Bluebutton, ICD-10, GoodRX API, RXNorm API, Phaxio, and UMA support.
Other
74 stars 53 forks source link

docker install instructions #136

Open zeigerpuppy opened 4 years ago

zeigerpuppy commented 4 years ago

I note there is a Dockerfile in the repository. It would be helpful to have some information about installation with Docker (ideally with docker-compose).

Is the docker installation working/tested?

zeigerpuppy commented 4 years ago

I have tried building, but build fails (last part of build log below)

Build process completed successfully
Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
install ok: channel://pecl.php.net/imagick-3.4.4
configuration option "php_ini" is not set to php.ini location
You should add "extension=imagick.so" to php.ini
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/1) Installing .docker-php-ext-enable-deps (20200310.015120)
OK: 403 MiB in 110 packages
WARNING: Ignoring APKINDEX.b89edf6e.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.737f7e01.tar.gz: No such file or directory
(1/1) Purging .docker-php-ext-enable-deps (20200310.015120)
OK: 403 MiB in 109 packages
WARNING: Ignoring APKINDEX.b89edf6e.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.737f7e01.tar.gz: No such file or directory
(1/27) Purging .build-deps (20200310.014813)
(2/27) Purging libjpeg-turbo-dev (1.5.3-r6)
(3/27) Purging libxml2-dev (2.9.9-r2)
(4/27) Purging php7-dev (7.2.27-r0)
(5/27) Purging php7 (7.2.27-r0)
(6/27) Purging php7-common (7.2.27-r0)
(7/27) Purging autoconf (2.69-r2)
(8/27) Purging m4 (1.4.18-r1)
(9/27) Purging perl (5.26.3-r0)
(10/27) Purging g++ (8.3.0-r0)
(11/27) Purging gcc (8.3.0-r0)
(12/27) Purging binutils (2.31.1-r2)
(13/27) Purging libatomic (8.3.0-r0)
(14/27) Purging libgomp (8.3.0-r0)
(15/27) Purging libc-dev (0.7.1-r0)
(16/27) Purging musl-dev (1.1.20-r5)
(17/27) Purging make (4.2.1-r2)
(18/27) Purging pcre-dev (8.42-r1)
(19/27) Purging libpcre16 (8.42-r1)
(20/27) Purging libpcre32 (8.42-r1)
(21/27) Purging libpcrecpp (8.42-r1)
(22/27) Purging pcre (8.42-r1)
(23/27) Purging bzip2-dev (1.0.6-r7)
(24/27) Purging mpc1 (1.0.3-r1)
(25/27) Purging mpfr3 (3.1.5-r1)
(26/27) Purging isl (0.18-r0)
(27/27) Purging gmp (6.1.2-r1)
Executing busybox-1.31.1-r9.trigger
OK: 178 MiB in 82 packages
ERROR: Service 'nosh-web' failed to build: lstat /var/lib/docker/devicemapper/mnt/a4a6b7985c54781af52d7f0b8b87aad24580cb2b976663b24355c0d9167c62e8/rootfs/bin/bash: bad message
zeigerpuppy commented 4 years ago

I have updated a docker-compose config which now gets most of the way to running (see below). The services start but I am still hitting a query exception on database:

log:

nosh-web    | Database
nosh-web    | information_schema
nosh-web    | nosh
nosh-web    |
nosh-web    | Migration table created successfully.
nosh-web    | **************************************
nosh-web    | *     Application In Production!     *
nosh-web    | **************************************
nosh-web    |
nosh-web    | Command Cancelled!
nosh-web    | 2020-03-11 11:09:30,130 INFO Set uid to user 0 succeeded
nosh-web    | 2020-03-11 11:09:30,133 INFO supervisord started with pid 1
nosh-web    | 2020-03-11 11:09:31,136 INFO spawned: 'php-fpm' with pid 23
nosh-web    | 2020-03-11 11:09:31,140 INFO spawned: 'laravel-schedule_00' with pid 24
nosh-web    | [11-Mar-2020 11:09:31] NOTICE: fpm is running, pid 23
nosh-web    | [11-Mar-2020 11:09:31] NOTICE: ready to handle connections
nosh-web    | Running scheduled command: App\Http\Controllers\ReminderController@reminder
nosh-web    | 2020-03-11 11:09:32,175 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
nosh-web    | 2020-03-11 11:09:32,175 INFO success: laravel-schedule_00 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
nosh-web    |
nosh-web    |    Illuminate\Database\QueryException  : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nosh.schedule' doesn't exist (SQL: select `demographics`.`reminder_to`, `demographics`.`reminder_method`, `demographics`.`reminder_interval`, `schedule`.`appt_id`, `schedule`.`provider_id`, `schedule`.`start` from `schedule` inner join `demographics` on `schedule`.`pid` = `demographics`.`pid` where `schedule`.`status` = Pending and `schedule`.`start` between 1583924972 and 1584097772)
nosh-web    |
nosh-web    |   at /var/www/nosh/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
nosh-web    |     665|         // If an exception occurs when attempting to run a query, we'll format the error
nosh-web    |     666|         // message to include the bindings with SQL, which will make this exception a
nosh-web    |     667|         // lot more helpful to the developer instead of just the database's errors.
nosh-web    |     668|         catch (Exception $e) {
nosh-web    |   > 669|             throw new QueryException(
nosh-web    |     670|                 $query, $this->prepareBindings($bindings), $e
nosh-web    |     671|             );
nosh-web    |     672|         }
nosh-web    |     673|
nosh-web    |
nosh-web    |   Exception trace:
nosh-web    |
nosh-web    |   1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nosh.schedule' doesn't exist")
nosh-web    |       /var/www/nosh/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:63
nosh-web    |
nosh-web    |   2   PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nosh.schedule' doesn't exist")
nosh-web    |       /var/www/nosh/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:61
nosh-web    |
nosh-web    |   Please use the argument -v to see more details.
nosh-web    | Running scheduled command: App\Http\Controllers\ReminderController@reminder

docker-compose.yml

version: '3'
services:
     nosh-web:
        restart: always
        build:
            context: ../nosh2/
            dockerfile: Dockerfile
        container_name: nosh-web
        depends_on:
            - nosh-db
        expose:
            - "9000"
        volumes:
            - noshweb:/var/www/nosh
            - noshdocuments:/noshdocuments
        environment:
            DB_HOST: ${DB_HOST}
            DB_DATABASE: nosh
            DB_USERNAME: ${DB_USERNAME}
            DB_PASSWORD: ${DB_PASSWORD}
        networks:
            docker2:
              ipv4_address: ${IP_NOSHWEB}

     nosh-db:
        container_name: nosh-db
        image: mysql:5.7
        restart: always
        volumes:
            - noshdb:/var/lib/mysql
        environment:
            MYSQL_DATABASE: nosh
            MYSQL_USER: ${DB_USERNAME}
            MYSQL_PASSWORD: ${DB_PASSWORD}
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
        expose:
            - "3306"
        networks:
            docker2:
              ipv4_address: ${IP_NOSHDB}

# network
networks:
  docker2:
    external:
      name: docker2

# named volumes 
volumes:
    noshweb:
      driver: local
      driver_opts:
        type: 'none'
        device: '${PWD}/volumes/noshweb'
        o: 'bind'

    noshdocuments:
      driver: local
      driver_opts:
        type: 'none'
        device: '${PWD}/volumes/noshdocs'
        o: 'bind'

    noshdb:
      driver: local
      driver_opts:
        type: 'none'
        device: '${PWD}/volumes/noshdb'
        o: 'bind'

a lot of the networking stuff is particular to my install and not needed for a simple docker deployment, but that's not the cause of the issue. I think the database hasn't been properly populated.

shihjay2 commented 3 years ago

Please review docker-nosh for a completed Docker solution for NOSH.