diff --git a/README.md b/README.md index 2e7a02b..6404539 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ Yet another try to containerize [REDCap](https://www.project-redcap.org/) but wi - [Custom apache virtual host directives](#custom-apache-virtual-host-directives) - [Custom install SQL Script](#custom-install-sql-script) - [User provisioning files](#user-provisioning-files) + - [REDCap file repository](#redcap-file-repository) - [File Ownership](#file-ownership) # Disclaimer @@ -54,14 +55,12 @@ This is our try, to containerize REDCap in a way, we can deploy a new instance, # Roadmap -* Define user file repo directory in env var (investigate) -* Testing if REDCap upgrades work with this setup +* Testing if REDCap upgrades work with this setup (probably will) # Ideas * Project provisioning - # Minimal example docker compose > We assume some basic knowledge about `docker` and `docker compose` and that it is installed @@ -151,6 +150,16 @@ If the file is not provided, we will just pull a generic version it from the RED `/opt/redcap-docker/users` directory that will be scanned for user data to be provisioned. See [User provisioning](#user-provisioning) for more details. +### REDCap file repository + +By the default the REDCap user uploaded filw will be saved into your document root dir `/var/www/html/edocs`. But as stated by the REDCap manual you may want to change that. + +This is easy with this container image, Just set `RCCONF_edoc_path` (e.g. `RCCONF_edoc_path=/data`) to the path of your choice and mount this path via docker to your host system. + +Have a look at the [docker compose example](examples/local_instance_custom_edocs) how it works in action. + + + ## File Ownership If you are not happy with the file ownership UID/GID of the containers internal apache run user, have a look at [`WWW_DATA_UID`/`WWW_DATA_GID`](#www-data-user-and-group-id). diff --git a/examples/local_instance_custom_edocs/README.md b/examples/local_instance_custom_edocs/README.md new file mode 100644 index 0000000..bbd1ee6 --- /dev/null +++ b/examples/local_instance_custom_edocs/README.md @@ -0,0 +1,5 @@ +# Simple docker compose example + +This example show how to save user upload into a non apache folder + +Have a look at the docker-composes.yaml `volumes:` and environment variables at `environment:` \ No newline at end of file diff --git a/examples/local_instance_custom_edocs/docker-compose.yaml b/examples/local_instance_custom_edocs/docker-compose.yaml new file mode 100644 index 0000000..4a2260c --- /dev/null +++ b/examples/local_instance_custom_edocs/docker-compose.yaml @@ -0,0 +1,81 @@ +services: + redcap: + image: dzdde/redcap-docker + environment: + DB_PORT: 3306 + DB_HOSTNAME: db + DB_NAME: redcap + DB_USERNAME: redcap + DB_PASSWORD: redcap123 + # Do not reuse this example DB_SALT + DB_SALT: d369a86842347f7e3e40a3ec64b9f9d950bdfde05beba3a61da69bb1fb28dcea9152fbf723889181a9bd9a97f34b90faf17a + REDCAP_INSTALL_ENABLE: true + APPLY_RCCONF_VARIABLES: true + + # Here we define where to store user uploaded files + RCCONF_edoc_path: /data + + RCCONF_institution: "Weyland-Yutani Corporation" + RCCONF_homepage_contact: "Karl Bishop " + RCCONF_homepage_contact_email: "k.bishop@wyyu.earth" + RCCONF_project_contact_name: Colette Ferro + RCCONF_project_contact_email: c.ferro@wyyu.earth + restart: always + depends_on: + db: + condition: service_healthy + ports: + - "80:80" + volumes: + # We mount the upload repo to the local path ./data/user-files + - ./data/user-files:/data + - ./data/redcap:/var/www/html + logging: + options: + max-size: "10m" + max-file: "3" + db: + image: mysql:lts + restart: always + cap_add: + - SYS_NICE # CAP_SYS_NICE + volumes: + - ./data/db:/var/lib/mysql + ports: + - 3306:3306 + environment: + - MYSQL_ROOT_PASSWORD=redcaproot123 + - MYSQL_DATABASE=redcap + - MYSQL_USER=redcap + - MYSQL_PASSWORD=redcap123 + - TZ=UTC + healthcheck: + test: "/usr/bin/mysql -u $$MYSQL_USER -p$$MYSQL_PASSWORD $$MYSQL_DATABASE --execute \"SHOW TABLES;\"" + timeout: 3s + interval: 5s + retries: 4 + command: + # Per REDCap Recommendations + - --max_allowed_packet=128M + # If you have a larger development database, you may want to increase this value: + # Default is 128MB (134217728) - I'm upping it to 512MB + - --innodb_buffer_pool_size=536870912 + # 2x default + # sort_buffer_size=524288 + - --sort_buffer_size=1024K + # Default + #read_rnd_buffer_size=262144 + - --read_rnd_buffer_size=1024K + # By default we only accept connections from localhost but we want to allow connections from anywhere! + # bind-address=127.0.0.1 + - --bind-address=0.0.0.0 + # MAKE SEPARATE FILES PER TABLE + - --innodb_file_per_table=1 + # Disabling symbolic-links is recommended to prevent assorted security risks + - --symbolic-links=0 + # SLOW QUERY LOGGING + - --log_output=FILE + - --slow_query_log=0 + - --slow_query_log_file=/var/log/mysql_slow.log + - --long_query_time=2.000 + - --log-queries-not-using-indexes=0