fr0tt / benotes

An open source self hosted notes and bookmarks taking web app.
https://benotes.org
MIT License
746 stars 48 forks source link

Add image to Docker Hub #30

Closed AuthorShin closed 2 years ago

AuthorShin commented 2 years ago

Hello when will you consider adding the docker image to hub.docker.com?

fr0tt commented 2 years ago

Hello, I'm considering since the day you opened the issue ;) I still need to figure some things out / test it but it will be soon available.

AuthorShin commented 2 years ago

Thank you very much, and I would highly appreciate it if possible it will be just one container not a stack so it will be much more easier to install and deploy on docker management systems like casaOS.

fr0tt commented 2 years ago

So it took me a while but after some research into CasaOS ( I saw your docker-compose issue :) ), how it works and apps that already work with it I think I finally made it happen. Originally I wanted to separate the database but after your comment I decided to support SQLite which allows me to put everything in one image.

You can find the docker image here and installation instructions here.

It is safe to say that things are a little bit more complicated with CasaOS because as far as I researched env-file and named volumes are not supported. Meaning you have to set all variables from this file as environment variables. (Perhaps it's already enough if you only set APP_KEY, JWT_SECRET, DB_CONNECTION, APP_ENV, APP_URL and RUN_MIGRATIONS)

Also regarding the volumes you need to define 4 volumes (except if you have found a way to use named volumes that is). Let's say you have created a folder called benotes in CasaOS:

If you have any questions or should it not work (as expected) do not hesitate to ask me.

AuthorShin commented 2 years ago

@fr0tt Thanks a lot man I tried to setup it as you said and container start running but it's not showing anything on the webpage and I got this in the logs: -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable -> Executing /opt/docker/provision/entrypoint.d/05-permissions.sh -> Executing /opt/docker/provision/entrypoint.d/20-nginx.sh -> Executing /opt/docker/provision/entrypoint.d/20-php-fpm.sh -> Executing /opt/docker/provision/entrypoint.d/20-php.sh -> Executing /entrypoint.d/app_entrypoint.sh /entrypoint.d/app_entrypoint.sh: line 7: RUN_MIGRATIONS: unbound variable

fr0tt commented 2 years ago

Your welcome !

Oh that was a rather obvious mistake of mine. You need to add RUN_MIGRATIONS (set to false). I updated the file accordingly.

AuthorShin commented 2 years ago

@fr0tt Thanks for the help, it's up and running but stuck in login page.

Benotes stuck at login page
fr0tt commented 2 years ago

Have you already executed those two commands (mentioned in the documentation) ? (You can execute them in Casa in the container's settings by clicking on the terminal icon in the upper right corner.)

php artisan migrate
php artisan install --only-user
AuthorShin commented 2 years ago

@fr0tt Unfortunately, my casaOS is kinda corrupted so that terminal for each container is not working.

AuthorShin commented 2 years ago

Using SSH I got these errors:

Error when executing command inside the benotes docker container
fr0tt commented 2 years ago

Strange, it definitely has something to do with your database but I'm not quite sure what it is.

Can you tell me what environment variables you set for the database ?

There are three working possibilities:

DB_CONNECTION=sqlite

or

DB_CONNECTION=sqlite
DB_DATABASE=storage/database.sqlite

or

DB_CONNECTION=sqlite
DB_HOST=
DB_PORT=
DB_DATABASE=storage/database.sqlite
DB_USERNAME=
DB_PASSWORD=

If that's not the issue then can you tell me what permission does the file /var/www/storage/database.sqlite has ? (with e.g. the command ls -l) It should be -rw-r--r-- applicat(ion):applicat

fr0tt commented 2 years ago

So I thought about it a little longer and you can probably forget my previous answer.

Try to change the bind mount from benotes/storage/database.sqlite to benotes/database.sqlite:/var/www/storage/database.sqlite and more importantly create an empty database.sqlite file beforehand (otherwise it tries to create a folder instead which causes the whole issue).

AuthorShin commented 2 years ago

@fr0tt I removed the directory from the previous attempts and then create folder and database file and then install the container as you said and then run those two commands and boom, it's working =D Thanks a lot man, thanks a lot

AuthorShin commented 2 years ago

A little suggestion to add latest tag in hub.docker.com so if you update the container we can easily update it even via something like watchtower.

fr0tt commented 2 years ago

I'm glad it works, thanks for being so patient. And your welcome. I know it can be quite frustrating sometimes to install something ;)

I already realized that and added that tag yesterday (, it's the most important one after all).

AuthorShin commented 2 years ago

@fr0tt Thank you for all the time and effort :)