hallowelt / docker-bluespice-free

BlueSpice Enterprise Wiki Free Edition for Docker builds.
https://www.bluespice.com
15 stars 11 forks source link

Add -firstrun environment variable #1

Closed ArtificialTruth closed 4 years ago

ArtificialTruth commented 4 years ago

First of all, thank you for creating this excellent Docker image. I would like to suggest an improvement for this image. Disclaimer: I am new to Docker, so the following suggestion may not be in line with best pratices.

Current situation: When a container is created based on the bluespice/bluespice-free image, the init.sh script will setup the wiki for the first time (if the .firstrun file exists) If you want to keep your data outside of the docker (persistent storage) you can use the -v option Then you can change LocalSettings.php, add some pages in the wiki etc easily. When the container is stopped and removed, the data will stay.

Complication: When creating a new container (from same image, or perhaps future image) BlueSpice will install the wiki and overwrite the contents that is mounted with -v, thus loosing any changes made to LocalSettings.php etc.

Question: How can we create a new container that uses the same data & configs made by previous containers, without overwriting the configs with the defaults?

Suggestion: Create a new enviroment variable "firstrun=false", if set to false, this line will not run in the Dockerfile, and thus no "/opt/docker/.firstrun" file is created

Eg run the container with: docker run -d -p 80:80 -v {/my/data/folder}:/data -e "firstrun=false" "bs_lang=en" -e "bs_url=http://www.domain.com" bluespice/bluespice-free

gokhangeyik commented 4 years ago

Hello,

Thank you for your feedback and detailed explanation. The selective firstrun idea is actually great. We don't need to discuss it even. I will implement this as soon as possible.

ArtificialTruth commented 4 years ago

Thank you! Have a great day!

gokhangeyik commented 4 years ago

Hello,

I made the required changes but at the same time, I want to keep it simple. So we don't need to define any environment variable for it. Basically init.sh will understand existing installations.

init.sh will gonna check /data/mysql folder existence and also /data/www/bluespice/w/LocalSettings.php file existence. In this case, the script will try to migrate current data to the new installation. Old files will be left at /data/www/bs_old.

I have not released this one on the docker hub yet. I need more tests. If you can find time for the test, I will be so happy.

Thank you very much.

gokhangeyik commented 4 years ago

A new version is released (3.1.3) With this new version, the Docker image will understand the current installation.

Thank you for your contribution.

ArtificialTruth commented 4 years ago

Hi @gokhangeyik

Thank you very much for your support. I have not had the time to test it out, but I greatly appriciate your work.

Have a wonderful week!