woa7 / docker-piler

Docker: piler is an open source email archiving application with lots of features aimed for the enterprises, http://www.mailpiler.org/
GNU General Public License v3.0
6 stars 5 forks source link

start.sh is missing an if statement to check to see if database already exists #2

Closed bmv234 closed 4 years ago

bmv234 commented 4 years ago

If the container is ran with an restart flag (Ex. --restart unless-stopped) and the container is stopped and restarted (Ex. Host Reboot) then I get the following error:

Creating mysql database ERROR 1007 (HY000) at line 1: Can't create database 'piler'; database exists [cmd] /start.sh exited 1 [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] waiting for services. [s6-finish] sending all processes the TERM signal. [s6-finish] sending all processes the KILL signal and exiting

Would you consider adding an if statement to the start.sh script to check if the database already exists to avoid this situation?

woa7 commented 4 years ago

can you try my last q&d fix?

bmv234 commented 4 years ago

Looks like everything worked now. Just one minor change to your README needed.

You are passing two build arguments so need to add one more --build-arg before PACKAGE_DOWNLOAD_SHA256

This works:

docker build --build-arg PACKAGE=piler_1.3.7-bionic-94c54a0_amd64.deb --build-arg PACKAGE_DOWNLOAD_SHA256=025bf31155d31c4764c037df29703f85e2e56d66455616a25411928380f49d7c -t woa7/piler .

bmv234 commented 4 years ago

Got Piler running but I am now having issues when trying to apply retention rules, with the popup:

Add the following to /etc/sudoers: 'www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload'

I have added www-data ALL=NOPASSWD: /etc/init.d/rc.piler reload to the /etc/sudoers file and rebooted the server but still no luck. I am running Ubuntu Server 18.04 LTS Any suggestions?

woa7 commented 4 years ago

i will take a look in this. (at moment my test env is limited, so sorry for the fuss.)

woa7 commented 4 years ago

so now the sudo stuff work. can you test it?

bmv234 commented 4 years ago

Sudo works now. Thanks

One other note, in your README the example docker create command is missing -p 25:25 so port 25 will be expose and smtp can work:

docker create --name=piler -e PUID=1000 #optional -e PGID=1000 #optional -e TZ=Europe/London #optional -e PILER_HOST=archive.example.org -p 25:25 -p 443:443 #optional -p 80:80 -v </path/to/appdata/config>:/var/piler --restart unless-stopped woa7/piler:1.3.7

woa7 commented 4 years ago

ToDo for me: fix readme (-p 25:25, PUID, and source links)