pmkruyen / dearscholar

DearScholar: An open-source smartphone app for longitudinal scientific qualitative and quantitative (self-report) diary, log and survey research
GNU General Public License v3.0
10 stars 4 forks source link

Automate installation with Docker #29

Closed kinow closed 4 years ago

kinow commented 4 years ago

Hi Peter,

I used this pull request to automate the installation steps from your new Wiki. To run, I used the following steps.

docker build -t dearscholar:dev -f Dockerfile . # dearscholar:dev can be anything, but normally it's image ID followed by a tag
docker run -ti --rm --name dearscholar -p "80:80" dearscholar:dev # I used rm as otherwise I forget to clean up containers, and also named the container dearscholar

With these two commands, my container was up and running. When executed the first time, the container entry point checks if the file /var/www/html/dearscholar.php exists. It will exist inside the container (see the COPY instructions in Dockerfile), but in another location (/installation/dearscholar.php).

If this file does not exist, then the container will run the commands from the installation Wiki page with mysql -u root... and php ..., and finally copy the PHP script to /var/www/html/dearscholar.php.

So users can stop and start the container again.

If users prefer to use an external volume, they can use the -v app .... -v mysql... from the installation instructions. They can choose other local names, such as -v data-app:/app, for instance, to avoid naming conflicts with folders in DearScholar.

Important to remember this automates Server & Database steps. Users still need to edit the dearscholar.js file to point to the backend.

Feel free to edit files here, modify, remove, or even close PR and use parts or just use as reference :+1: this is the least I could do after you went way out of your way to help me with the build instructions.

Thanks a lot for your help, looking forward to the automated testing issue now! Bruno

Hope it helps Bruno

pmkruyen commented 4 years ago

Hi Bruno,

This is fantastic.

Thanks for all this! When I am back at work I try to replicate your steps to learn how this works and merge your pull request.

this is the least I could do after you went way out of your way to help me with the build instructions.

Thanks for challenging me! 😃 Learned a lot in the last two weeks because of your feedback. I'm happy that the app is working on your machine :)

Peter

pmkruyen commented 4 years ago

The Docker works!