Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Docker container #497

Open
kasnder opened this issue Nov 15, 2022 · 9 comments
Open

Feature request: Docker container #497

kasnder opened this issue Nov 15, 2022 · 9 comments

Comments

@kasnder
Copy link

kasnder commented Nov 15, 2022

We would love to host a formr instance by our research group but have a limited server environment. To set up an instance, it'd be great if there was a ready-to-use docker container to install formr with a few clicks. @ulyngs

@ulyngs
Copy link

ulyngs commented Nov 16, 2022

I believe we've tried to follow the instructions currently available but were unable to make it work! :(

@rubenarslan
Copy link
Owner

Send me an email please :-)

@jvanalst
Copy link

jvanalst commented Feb 8, 2023

Just started working on a Docker Composition for Formr for a researcher. There's definitely demand for a working Docker container.

@jvanalst
Copy link

jvanalst commented Feb 9, 2023

v10.0.5 working in a Docker Container without a DB, Cron, or OpenCPU (yet). I know for the Database I'll be using MySQL official image in a docker-compose.yml. Not sure what to do about the Cron or OpenCPU.

There is an official OpenCPU Image on Docker Hub, but I'm not sure how to use it in a composition yet. And I don't know what it is or how to use the API anyways to test it. Heck, at this point I don't even know if I should be using the base image or the rstudio image.

Putting the cron on the same machine as the PHP-Apache violates Docker's philosophy of separation (1 machine for 1 job). Hence not sure what to do... whether to install Supervisor (a hacky way of getting around the issue), or just spool up cron specific machine (probably the correct way to do it).

# syntax=docker/dockerfile:1

FROM php:7.4.33-apache

# Install System & PHP Dependencies
RUN apt-get update 
RUN apt-get upgrade -y
RUN apt-get install -y pandoc libzip-dev libxml2-dev libpng-dev libonig-dev libsodium-dev libcurl4-openssl-dev git
RUN docker-php-ext-install zip xml gd intl mbstring curl pdo pdo_mysql

# Install Composer from Official Composer Image
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

# Configure PHP
COPY formr/usr/local/etc/php/php.ini /usr/local/etc/php/php.ini

# Install & Configure FormR
WORKDIR /var/www
RUN rm -r html
RUN git clone https://github.com/rubenarslan/formr.org.git html
WORKDIR /var/www/html
RUN git checkout v10.0.5
RUN chown -R www-data:www-data /var/www/html
RUN composer install
COPY formr/var/www/html/config /var/www/html/config

# Configure Apache2
RUN a2enmod rewrite headers
COPY formr/etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf
RUN service apache2 restart

@cyriltata
Copy link
Collaborator

cyriltata commented Feb 9, 2023 via email

@jvanalst
Copy link

jvanalst commented Feb 9, 2023

@cyriltata Oh interesting. I didn't notice it was an older version (2016). I just assumed since it was the highest version number it was the release. I'll switch to working v0.20.x.

@jvanalst
Copy link

jvanalst commented Feb 9, 2023

# syntax=docker/dockerfile:1

FROM php:8.2.2-apache

# Install System & PHP Dependencies
RUN apt-get update 
RUN apt-get upgrade -y
RUN apt-get install -y pandoc libzip-dev libxml2-dev libpng-dev libonig-dev libsodium-dev libcurl4-openssl-dev git
RUN docker-php-ext-install zip xml gd intl mbstring curl pdo pdo_mysql

# Install Composer from Official Composer Image
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

# Configure PHP
COPY formr/usr/local/etc/php/php.ini /usr/local/etc/php/php.ini

# Install & Configure Formr
WORKDIR /var/www
RUN rm -r html
RUN git clone https://github.com/rubenarslan/formr.org.git
RUN ln -s /var/www/formr.org/webroot /var/www/html
WORKDIR /var/www/formr.org
RUN git checkout v0.20.5
RUN composer install
COPY formr/var/www/formr.org/config /var/www/formr.org/config
RUN chown -R www-data:www-data /var/www/formr.org

# Configure Apache2
RUN a2enmod rewrite headers
COPY formr/etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf
RUN service apache2 restart

@NS21fpsy
Copy link

Does anyone have a YAML for a setup with Docker Compose, where the different components (like formR, database, OpenCPU) work together?

Or does anyone have a Docker image that does not separate the components into different containers, but configures everything together in the same container?

Does anyone have a repository where I can look at such a solution?
Thanks and best regards

@cyriltata
Copy link
Collaborator

@NS21fpsy you could try our experimental image https://hub.docker.com/r/formr/formr.org that could be deployed with this docker-compose https://github.com/cyriltata/formr.docker (read instructions). It sets up the formr software and mysql in two different containers.

opencpu on the other one could be installed in another machine or they do also have an image https://hub.docker.com/r/opencpu/base, which you need to install your necessary R packages on, including the formr R package.

Let us know if you succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants