azimuttapp / azimutt

Explore and optimize any database
https://azimutt.app
MIT License
1.21k stars 84 forks source link

Unable to login with email/password auth #312

Closed danielepintore closed 2 weeks ago

danielepintore commented 2 months ago

Hi, I'm trying to locally deploy the app for some testing, using the docker-compose, I'm able to start the backend and the database server, i get the login page but i can't login, it says "Email or Password invalid." Have you changed the default password? I'm trying to log in with: admin@azimutt.app as email and admin as password

I start the application with this command: docker compose --env-file .env up in the root directory of the repository. Thanks in advance for the help :)

This is my .env file:

PHX_SERVER=true
PHX_HOST=localhost
PORT=4000
SECRET_KEY_BASE=1wOVZ9rWAqPcbVZdilZzBPLXFKNrUmLUzX0q9Z02LpOy2jVWZwa6ee4fU81tuN+W
DATABASE_URL=postgresql://postgres:postgres@localhost/azimutt_dev
FILE_STORAGE_ADAPTER=local
AUTH_PASSWORD=true

This is the output from the docker compose:

[database] | The files belonging to this database system will be owned by user "postgres".
[database] | This user must also own the server process.
[database] |
[database] | The database cluster will be initialized with locale "en_US.utf8".
[database] | The default database encoding has accordingly been set to "UTF8".
[database] | The default text search configuration will be set to "english".
[database] |
[database] | Data page checksums are disabled.
[database] |
[database] | fixing permissions on existing directory /var/lib/postgresql/data ... ok
[database] | creating subdirectories ... ok
[database] | selecting dynamic shared memory implementation ... posix
[database] | selecting default max_connections ... 100
[database] | selecting default shared_buffers ... 128MB
[database] | selecting default time zone ... Etc/UTC
[database] | creating configuration files ... ok
[database] | running bootstrap script ... ok
[backend]  | Setup Local file storage
[backend]  | Setup Local email provider
[backend]  | Setup Password auth
[backend]  | 14:23:43.671 [error] Postgrex.Protocol (#PID<0.163.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (database:5432): connection refused - :econnrefused
[backend]  | 14:23:43.671 [error] Postgrex.Protocol (#PID<0.162.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (database:5432): connection refused - :econnrefused
[database] | performing post-bootstrap initialization ... ok
[database] | syncing data to disk ... ok
[database] |
[database] |
[database] | Success. You can now start the database server using:
[database] |
[database] |     pg_ctl -D /var/lib/postgresql/data -l logfile start
[database] |
[database] | initdb: warning: enabling "trust" authentication for local connections
[database] | initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
[database] | waiting for server to start....2024-07-05 14:23:44.604 UTC [43] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
[database] | 2024-07-05 14:23:44.605 UTC [43] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
[database] | 2024-07-05 14:23:44.612 UTC [46] LOG:  database system was shut down at 2024-07-05 14:23:43 UTC
[database] | 2024-07-05 14:23:44.620 UTC [43] LOG:  database system is ready to accept connections
[database] |  done
[database] | server started
[database] | CREATE DATABASE
[database] |
[database] |
[database] | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
[database] |
[database] | waiting for server to shut down....2024-07-05 14:23:44.903 UTC [43] LOG:  received fast shutdown request
[database] | 2024-07-05 14:23:44.904 UTC [43] LOG:  aborting any active transactions
[database] | 2024-07-05 14:23:44.910 UTC [43] LOG:  background worker "logical replication launcher" (PID 49) exited with exit code 1
[database] | 2024-07-05 14:23:44.910 UTC [44] LOG:  shutting down
[database] | 2024-07-05 14:23:44.912 UTC [44] LOG:  checkpoint starting: shutdown immediate
[backend]  | 14:23:45.133 [error] Postgrex.Protocol (#PID<0.162.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (database:5432): connection refused - :econnrefused
[database] | 2024-07-05 14:23:45.367 UTC [44] LOG:  checkpoint complete: wrote 923 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.076 s, sync=0.369 s, total=0.458 s; sync files=301, longest=0.002 s, average=0.002 s; distance=4257 kB, estimate=4257 kB; lsn=0/1913078, redo lsn=0/1913078
[database] | 2024-07-05 14:23:45.381 UTC [43] LOG:  database system is shut down
[database] |  done
[database] | server stopped
[database] |
[database] | PostgreSQL init process complete; ready for start up.
[database] |
[database] | 2024-07-05 14:23:45.452 UTC [1] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
[database] | 2024-07-05 14:23:45.453 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
[database] | 2024-07-05 14:23:45.453 UTC [1] LOG:  listening on IPv6 address "::", port 5432
[database] | 2024-07-05 14:23:45.455 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
[database] | 2024-07-05 14:23:45.461 UTC [59] LOG:  database system was shut down at 2024-07-05 14:23:45 UTC
[database] | 2024-07-05 14:23:45.469 UTC [1] LOG:  database system is ready to accept connections
[backend]  | 14:23:48.356 [info] == Running 20220903194509 Azimutt.Repo.Migrations.InitDatabase.change/0 forward
[backend]  | 14:23:48.361 [info] execute "CREATE EXTENSION IF NOT EXISTS citext"
[backend]  | 14:23:48.382 [info] create table users
[backend]  | 14:23:48.400 [info] create index users_slug_index
[backend]  | 14:23:48.404 [info] create index users_email_index
[backend]  | 14:23:48.408 [info] create table user_tokens
[backend]  | 14:23:48.420 [info] create index user_tokens_context_token_index
[backend]  | 14:23:48.425 [info] create index user_tokens_user_id_index
[backend]  | 14:23:48.428 [info] create table organizations
[backend]  | 14:23:48.437 [info] create index organizations_slug_index
[backend]  | 14:23:48.441 [info] create index organizations_name_index
[backend]  | 14:23:48.444 [info] create index organizations_stripe_customer_id_index
[backend]  | 14:23:48.446 [info] create table organization_members
[backend]  | 14:23:48.451 [info] create table organization_invitations
[backend]  | 14:23:48.456 [info] create index organization_invitations_organization_id_index
[backend]  | 14:23:48.459 [info] create table projects
[backend]  | 14:23:48.468 [info] create index projects_organization_id_slug_index
[backend]  | 14:23:48.476 [info] == Migrated 20220903194509 in 0.1s
[backend]  | 14:23:48.528 [info] == Running 20221116095052 Azimutt.Repo.Migrations.CreateTracking.change/0 forward
[backend]  | 14:23:48.529 [info] create table events
[backend]  | 14:23:48.541 [info] create index events_name_index
[backend]  | 14:23:48.546 [info] create index events_created_by_index
[backend]  | 14:23:48.550 [info] create index events_created_at_index
[backend]  | 14:23:48.554 [info] create index events_organization_id_index
[backend]  | 14:23:48.558 [info] create index events_project_id_index
[backend]  | 14:23:48.563 [info] == Migrated 20221116095052 in 0.0s
[backend]  | 14:23:48.570 [info] == Running 20221121135140 Azimutt.Repo.Migrations.CreateGallery.change/0 forward
[backend]  | 14:23:48.571 [info] alter table projects
[backend]  | 14:23:48.574 [info] create table gallery
[backend]  | 14:23:48.587 [info] create index gallery_project_id_index
[backend]  | 14:23:48.590 [info] create index gallery_slug_index
[backend]  | 14:23:48.594 [info] == Migrated 20221121135140 in 0.0s
[backend]  | 14:23:48.600 [info] == Running 20221205110011 Azimutt.Repo.Migrations.CreateHerokuResources.change/0 forward
[backend]  | 14:23:48.600 [info] create table heroku_resources
[backend]  | 14:23:48.609 [info] alter table users
[backend]  | 14:23:48.610 [info] alter table organizations
[backend]  | 14:23:48.612 [info] drop index organizations_name_index
[backend]  | 14:23:48.614 [info] == Migrated 20221205110011 in 0.0s
[backend]  | 14:23:48.621 [info] == Running 20221230162039 Azimutt.Repo.Migrations.AddProjectNbMemos.change/0 forward
[backend]  | 14:23:48.621 [info] alter table projects
[backend]  | 14:23:48.623 [info] == Migrated 20221230162039 in 0.0s
[backend]  | 14:23:48.628 [info] == Running 20230102142929 Azimutt.Repo.Migrations.AddDataForUsersAndOrgas.change/0 forward
[backend]  | 14:23:48.628 [info] alter table users
[backend]  | 14:23:48.629 [info] alter table organizations
[backend]  | 14:23:48.630 [info] == Migrated 20230102142929 in 0.0s
[backend]  | 14:23:48.635 [info] == Running 20230107144621 Azimutt.Repo.Migrations.AddProjectAccessTokens.change/0 forward
[backend]  | 14:23:48.635 [info] create table project_tokens
[backend]  | 14:23:48.643 [info] == Migrated 20230107144621 in 0.0s
[backend]  | 14:23:48.650 [info] == Running 20230126103538 Azimutt.Repo.Migrations.AllowNullOnStripeOrgaAndEventUser.change/0 forward
[backend]  | 14:23:48.650 [info] alter table organizations
[backend]  | 14:23:48.651 [info] alter table events
[backend]  | 14:23:48.656 [info] == Migrated 20230126103538 in 0.0s
[backend]  | 14:23:48.661 [info] == Running 20230412184510 Azimutt.Repo.Migrations.AddUserProfiles.change/0 forward
[backend]  | 14:23:48.661 [info] create table user_profiles
[backend]  | 14:23:48.668 [info] alter table users
[backend]  | 14:23:48.670 [info] == Migrated 20230412184510 in 0.0s
[backend]  | 14:23:48.675 [info] == Running 20230412190321 Azimutt.Repo.Migrations.CopyProfilesData.change/0 forward
[backend]  | 14:23:48.676 [info] execute "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
[backend]  | 14:23:48.680 [info] execute "INSERT INTO user_profiles (id, user_id, location, description, company, created_at, updated_at) SELECT uuid_generate_v4(), id, location, description, company, now(), now() FROM users;"
[backend]  | 14:23:48.681 [info] == Migrated 20230412190321 in 0.0s
[backend]  | 14:23:48.687 [info] == Running 20230412190524 Azimutt.Repo.Migrations.RemoveProfileDataFromUsers.change/0 forward
[backend]  | 14:23:48.687 [info] alter table users
[backend]  | 14:23:48.689 [info] alter table organizations
[backend]  | 14:23:48.690 [info] == Migrated 20230412190524 in 0.0s
[backend]  | 14:23:48.696 [info] == Running 20230701191613 Azimutt.Repo.Migrations.CreateCleverCloudResources.change/0 forward
[backend]  | 14:23:48.697 [info] create table clever_cloud_resources
[backend]  | 14:23:48.704 [info] == Migrated 20230701191613 in 0.0s
[backend]  | 14:23:48.713 [info] == Running 20231110120742 Azimutt.Repo.Migrations.CreateUserAuthTokens.change/0 forward
[backend]  | 14:23:48.713 [info] create table user_auth_tokens
[backend]  | 14:23:48.720 [info] == Migrated 20231110120742 in 0.0s
[backend]  | 14:23:48.727 [info] == Running 20240425124708 Azimutt.Repo.Migrations.ExtendOnboarding.change/0 forward
[backend]  | 14:23:48.728 [info] alter table user_profiles
[backend]  | 14:23:48.729 [info] == Migrated 20240425124708 in 0.0s
[backend]  | 14:23:48.735 [info] == Running 20240624135054 Azimutt.Repo.Migrations.ManagePlansInDb.change/0 forward
[backend]  | 14:23:48.735 [info] alter table organizations
[backend]  | 14:23:48.740 [info] == Migrated 20240624135054 in 0.0s
[backend]  | Setup Local file storage
[backend]  | Setup Local email provider
[backend]  | Setup Password auth
[backend]  | 14:23:51.102 [info] Running AzimuttWeb.Endpoint with cowboy 2.12.0 at :::4000 (http)
[backend]  | 14:23:51.116 [info] Access AzimuttWeb.Endpoint at https://localhost
[backend]  | 14:23:55.085 [info] tzdata release in place is from a file last modified Fri, 22 Oct 2021 02:20:47 GMT. Release file on server was last modified Thu, 01 Feb 2024 18:40:48 GMT.
[backend]  | 14:23:56.774 [info] Tzdata has updated the release from 2021e to 2024a

If I restart the stack i get this output:

[database] |
[database] | PostgreSQL Database directory appears to contain a database; Skipping initialization
[database] |
[database] | 2024-07-05 14:40:32.321 UTC [1] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
[database] | 2024-07-05 14:40:32.321 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
[database] | 2024-07-05 14:40:32.321 UTC [1] LOG:  listening on IPv6 address "::", port 5432
[database] | 2024-07-05 14:40:32.323 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
[database] | 2024-07-05 14:40:32.329 UTC [24] LOG:  database system was shut down at 2024-07-05 14:33:07 UTC
[database] | 2024-07-05 14:40:32.340 UTC [1] LOG:  database system is ready to accept connections
[backend]  | Setup Local file storage
[backend]  | Setup Local email provider
[backend]  | Setup Password auth
[backend]  | 14:40:33.116 [info] Migrations already up
[backend]  | Setup Local file storage
[backend]  | Setup Local email provider
[backend]  | Setup Password auth
[backend]  | 14:40:34.895 [info] Running AzimuttWeb.Endpoint with cowboy 2.12.0 at :::4000 (http)
[backend]  | 14:40:34.898 [info] Access AzimuttWeb.Endpoint at https://localhost
[backend]  | 14:40:38.826 [info] tzdata release in place is from a file last modified Fri, 22 Oct 2021 02:20:47 GMT. Release file on server was last modified Thu, 01 Feb 2024 18:40:48 GMT.
[backend]  | 14:40:40.526 [info] Tzdata has updated the release from 2021e to 2024a

To me it seems that everything is good.. Thanks again for the help

loicknuchel commented 1 month ago

Hello @danielepintore Passwords are encrypted using the SECRET_KEY_BASE, so as you changed it (which is expected), the default password don't work anymore. You can create an other account.