Open theAkito opened 1 year ago
Database creation routines are left up to the database container I believe. I don't know enough about the Freescout code to tell if it's attempting to create the database, but my experience says no.
I can see about throwing a halt error if the database population command fails, it would take some investigation to see if it did, otherwise start to trap the output and look for specific failure strings.
Database creation routines are left up to the database container I believe.
I thought so, which is why I was suprised to see this, as I'm using your PostgreSQL image, which is used in many scenarios. So, I assumed, that the fault cannot lie in the container made from that image.
Though, I also saw that there are a lot of custom users involved in the whole stack & now I'm starting to wonder, whether it fails to deal with a permission error on initialisation.
Okay, checked it now & all the files in /var/lib/postgresql/data
are set to 70:70
.
I can see about throwing a halt error if the database population command fails, it would take some investigation to see if it did, otherwise start to trap the output and look for specific failure strings.
Which log are you referring to, exactly?
I thought so, which is why I was suprised to see this, as I'm using your PostgreSQL image, which is used in many scenarios. So, I assumed, that the fault cannot lie in the container made from that image.
I rebuilt that image in the past month and added a whole bunch of functionality to the 15
branch. It definitely should auto create a database with settings that look similar to this:
freescout-db:
image: tiredofit/postgres:15
container_name: freescout-db
volumes:
- ./db:/var/lib/postgresql
environment:
- TIMEZONE=America/Vancouver
- CONTAINER_NAME=freescout-db
- CONTAINER_ENABLE_MONITORING=FALSE
- SUPERUSER_PASS=superduper
- DB01_NAME=freescout
- DB01_USER=freescout
- DB01_PASS=password
networks:
- services
restart: always
Though, I also saw that there are a lot of custom users involved in the whole stack & now I'm starting to wonder, whether it fails to deal with a permission error on initialisation.
Postgres 70, Nginx 80, and a whole lot more - It's messy, I agree, however they can be changed. I haven't had a problem and I run this stack and more after wrapping my head around it and it just works hands off.
I can see about throwing a halt error if the database population command fails, it would take some investigation to see if it did, otherwise start to trap the output and look for specific failure strings.
Which log are you referring to, exactly?
I'm executing this to populate the database (line 229 of cont-init.d/30-freescout) silent just hides the output, which you could change to show by setting SHOW_OUTPUT=TRUE
as an environment variable.. If you were inside the container you could execute the sudo ... command and hack away at it to get the database populated, restarting the container after that should proceed, but lets not get too far ahead of ourselves quite yet.
There's also a log which is what you may be seeing in /www/freescout/storage/logs/laravel.log, although it may not be active until a full installation is completed.
Want to share your docker-compose or similar stack info? I actually have never done a Postgres installation of Freescout, just happily chugging along with a few MariaDB instances but If this is widespread I would like to fix it.
docker-compose.yml
# https://github.com/tiredofit/docker-freescout/blob/main/examples/docker-compose.yml
version: "3.9"
services:
freescout-app:
image: tiredofit/freescout
container_name: freescout
# user: "1005"
links:
- freescout-db
volumes:
### If you want to perform customizations to the source and have access to it, then uncomment this line - This includes modules
- /storage/freescout/html:/www/html
# - /storage/freescout/data:/data
- /storage/freescout/logs:/www/logs
env_file:
- ./freescout.env
networks:
- proxy-tier
ports:
- 127.0.0.1:53129:80
restart: unless-stopped
freescout-db:
image: tiredofit/postgres
container_name: freescout_db
# user: "1005"
volumes:
- /storage/freescout/database/data:/var/lib/postgresql/data
env_file:
- ./freescout_db.env
networks:
- proxy-tier
restart: unless-stopped
# https://github.com/tiredofit/docker-db-backup
freescout-db-backup:
container_name: freescout-db-backup
# user: "1005"
image: tiredofit/db-backup
links:
- freescout-db
volumes:
- /storage/freescout/database/backup:/backup
env_file:
- ./freescout_db-backup.env
networks:
- proxy-tier
restart: unless-stopped
networks:
proxy-tier:
name: nginx-proxy
.env
Partial# Database
CONTAINER_ENABLE_MONITORING=FALSE
CREATE_DB=TRUE
DB_TYPE=pgsql
DB_HOST=freescout_db
DB_PORT=5432
POSTGRES_DB=freescout
POSTGRES_USER=freescout
POSTGRES_PASSWORD=bla1
FREESCOUT_NAME=freescout
FREESCOUT_USER=freescout
FREESCOUT_PASS=bla1
DB01_NAME=freescout
DB01_USER=freescout
DB01_PASS=bla1
DB_NAME=freescout
DB_USER=freescout
DB_PASS=bla1
ROOT_PASS=bla2
SUPERUSER_PASS=bla3
After adding the original PostgreSQL Docker Image environment variabales prefixed with POSTGRES_
, I got rid of the baby problems with not having a database created & finally I get the default database layout set up. Step accomplished!
Now, I need to know why/how the app does not add the Admin user, which I specified via environment variable, as described in this repository's descriptions.
I added the Admin user manually to the users
table. Now, I'm getting These credentials do not match our records.
and not error in any logs.
OK, moving forward!!
From the command line this is how to create a user:
artisan -n freescout:create-user --role=admin --firstName="${ADMIN_FIRST_NAME}" --lastName="${ADMIN_LAST_NAME}" --email="${ADMIN_EMAIL}" --password="${ADMIN_PASS}"
artisan -n freescout:create-user --role=admin --firstName="${ADMIN_FIRST_NAME}" --lastName="${ADMIN_LAST_NAME}" --email="${ADMIN_EMAIL}" --password="${ADMIN_PASS}"
freescout_db
Delete the user I created manually, previously.
psql -U freescout freescout
DELETE FROM users WHERE id=2;
freescout
chmod +x /www/html/artisan; /www/html/artisan -n freescout:create-user --role=admin --firstName="Admin" --lastName="Admin" --email="admin@admin.com" --password="adminpw"
Now, I can finally log in! Thank you!
Do you need any more information on this PostgreSQL based setup?
Excellent! I'm going to have a member of my team in future see this issue and attempt to recreate to make sure that Postgres instances are correctly supported. Glad you are on track and ready to use Freescout :)
Thank you very much for your kind words & your great, involved & swift support. It is truly highly appreciated. Thank you very much.
If you need anything, do not hesitate to contact me via mail or something, so we do not clutter this issue.
Not sure if this issue should be closed, since someone will try to reproduce it.
Basically https://github.com/tiredofit/docker-freescout/issues/59, but much worse.
On Postgres, it does not only not create the database, it does not do anything. Nothing. It successfully connects to the database, however it does not create the
freescout
user, it does not create thefreescout
database and even when I craft all those manually, it still does not fill the database with initial content.Example