SamR1 / docker-fittrackee

GNU General Public License v3.0
13 stars 0 forks source link

fittrackee exited with code 3 #15

Closed jimbobcraig closed 3 years ago

jimbobcraig commented 3 years ago

trying to run this as per the instructions in README.md. but i always get a failure of the fittrackee container. db and redis appear fine.

      Name                    Command               State            Ports
-----------------------------------------------------------------------------------
fittrackee         /bin/sh -c $VIRTUAL_ENV/bi ...   Exit 3
fittrackee-db      docker-entrypoint.sh postgres    Up       5432/tcp
fittrackee-redis   docker-entrypoint.sh redis ...   Up       0.0.0.0:6379->6379/tcp

docker-compose logs -f gives,

Attaching to fittrackee, fittrackee-db, fittrackee-redis
fittrackee-redis | 1:C 11 Jul 2021 15:21:38.130 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
fittrackee-redis | 1:C 11 Jul 2021 15:21:38.130 # Redis version=6.2.4, bits=64, commit=00000000, modified=0, pid=1, just started
fittrackee-redis | 1:C 11 Jul 2021 15:21:38.130 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
fittrackee-redis | 1:M 11 Jul 2021 15:21:38.132 * monotonic clock: POSIX clock_gettime
fittrackee-redis | 1:M 11 Jul 2021 15:21:38.135 * Running mode=standalone, port=6379.
fittrackee-redis | 1:M 11 Jul 2021 15:21:38.135 # Server initialized
fittrackee-redis | 1:M 11 Jul 2021 15:21:38.135 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
fittrackee-redis | 1:M 11 Jul 2021 15:21:38.135 * Ready to accept connections
fittrackee-db    | The files belonging to this database system will be owned by user "postgres".
fittrackee-db    | This user must also own the server process.
fittrackee-db    |
fittrackee-db    | The database cluster will be initialized with locale "en_US.utf8".
fittrackee-db    | The default database encoding has accordingly been set to "UTF8".
fittrackee-db    | The default text search configuration will be set to "english".
fittrackee-db    |
fittrackee-db    | Data page checksums are disabled.
fittrackee-db    |
fittrackee-db    | fixing permissions on existing directory /var/lib/postgresql/data ... ok
fittrackee-db    | creating subdirectories ... ok
fittrackee-db    | selecting dynamic shared memory implementation ... posix
fittrackee-db    | selecting default max_connections ... 100
fittrackee-db    | selecting default shared_buffers ... 128MB
fittrackee-db    | selecting default time zone ... Etc/UTC
fittrackee-db    | creating configuration files ... ok
fittrackee-db    | running bootstrap script ... ok
fittrackee-db    | performing post-bootstrap initialization ... ok
fittrackee-db    | syncing data to disk ... ok
fittrackee-db    |
fittrackee-db    |
fittrackee-db    | Success. You can now start the database server using:
fittrackee-db    |
fittrackee-db    |     pg_ctl -D /var/lib/postgresql/data -l logfile start
fittrackee-db    |
fittrackee-db    | initdb: warning: enabling "trust" authentication for local connections
fittrackee-db    | You can change this by editing pg_hba.conf or using the option -A, or
fittrackee-db    | --auth-local and --auth-host, the next time you run initdb.
fittrackee-db    | waiting for server to start....2021-07-11 15:21:39.428 UTC [46] LOG:  starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
fittrackee-db    | 2021-07-11 15:21:39.430 UTC [46] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
fittrackee-db    | 2021-07-11 15:21:39.436 UTC [47] LOG:  database system was shut down at 2021-07-11 15:21:39 UTC
fittrackee-db    | 2021-07-11 15:21:39.441 UTC [46] LOG:  database system is ready to accept connections
fittrackee-db    |  done
fittrackee-db    | server started
fittrackee-db    |
fittrackee-db    | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/create.sql
fittrackee-db    | DROP DATABASE
fittrackee-db    | psql:/docker-entrypoint-initdb.d/create.sql:1: NOTICE:  database "fittrackee" does not exist, skipping
fittrackee-db    | DROP ROLE
fittrackee-db    | psql:/docker-entrypoint-initdb.d/create.sql:2: NOTICE:  role "fittrackee" does not exist, skipping
fittrackee-db    | CREATE DATABASE
fittrackee-db    | CREATE ROLE
fittrackee-db    | GRANT
fittrackee-db    |
fittrackee-db    |
fittrackee-db    | 2021-07-11 15:21:39.741 UTC [46] LOG:  received fast shutdown request
fittrackee-db    | waiting for server to shut down....2021-07-11 15:21:39.742 UTC [46] LOG:  aborting any active transactions
fittrackee-db    | 2021-07-11 15:21:39.746 UTC [46] LOG:  background worker "logical replication launcher" (PID 53) exited with exit code 1
fittrackee-db    | 2021-07-11 15:21:39.747 UTC [48] LOG:  shutting down
fittrackee-db    | 2021-07-11 15:21:39.762 UTC [46] LOG:  database system is shut down
fittrackee-db    |  done
fittrackee-db    | server stopped
fittrackee-db    |
fittrackee-db    | PostgreSQL init process complete; ready for start up.
fittrackee-db    |
fittrackee-db    | 2021-07-11 15:21:39.874 UTC [1] LOG:  starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
fittrackee-db    | 2021-07-11 15:21:39.874 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
fittrackee-db    | 2021-07-11 15:21:39.874 UTC [1] LOG:  listening on IPv6 address "::", port 5432
fittrackee-db    | 2021-07-11 15:21:39.878 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
fittrackee-db    | 2021-07-11 15:21:39.883 UTC [74] LOG:  database system was shut down at 2021-07-11 15:21:39 UTC
fittrackee-db    | 2021-07-11 15:21:39.889 UTC [1] LOG:  database system is ready to accept connections
fittrackee exited with code 3
SamR1 commented 3 years ago

FitTrackee needs to connect to database to start. (note: unfortunately for now, application logs are located in fittrackee container, which does not make debugging easy in that case. I will fix docker-compose.yml.)

Is DATABASE_URL environment variable correctly initialized?

jimbobcraig commented 3 years ago

yes, before issuing the make,

source .env && echo $DATABASE_URL

shows the ENV variable to be correctly set.

make rebuild run init

completes with the following error.

Successfully built 02e1a8b275b5
Successfully tagged fittrackee_fittrackee:latest
Creating network "fittrackee_default" with the default driver
Creating fittrackee-redis ... done
Creating fittrackee-db    ... done
Creating fittrackee       ... done
ERROR: No container found for fittrackee_1
make: *** [Makefile:16: migrate] Error 1

are the scripts trying to create a second fittrackee container ? i'm beginning to think this is something simple I'm missing, but can't figure out what...

SamR1 commented 3 years ago

make init needs fittrackee container running.

I updated docker-compose.yml to mount a directory to store logs. Can you try the last version to get error displayed in gunicorn logs?

jimbobcraig commented 3 years ago

@SamR1 I appreciate the support, thanks

make rebuild run init

ends with error

Successfully built b84172bb8b8e
Successfully tagged fittrackee_fittrackee:latest
Recreating fittrackee-db ...
Recreating fittrackee-db ... done
Recreating 632aaadd99b3_fittrackee ... done
ERROR: No container found for fittrackee_1
make: *** [Makefile:16: migrate] Error 1

gunicorn.log shows

[2021-07-13 12:28:47 +0000] [7] [INFO] Starting gunicorn 20.1.0
[2021-07-13 12:28:47 +0000] [7] [INFO] Listening at: http://0.0.0.0:5000 (7)
[2021-07-13 12:28:47 +0000] [7] [INFO] Using worker: gthread
[2021-07-13 12:28:47 +0000] [8] [INFO] Booting worker with pid: 8
[2021-07-13 12:28:47 +0000] [9] [INFO] Booting worker with pid: 9
[2021-07-13 12:28:48 +0000] [9] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
    super().init_process()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/util.py", line 412, in import_app
    app = app(*args, **kwargs)
  File "/usr/src/app/.venv/lib/python3.9/site-packages/fittrackee/__init__.py", line 50, in create_app
    email_service.init_email(app)
  File "/usr/src/app/.venv/lib/python3.9/site-packages/fittrackee/emails/email.py", line 83, in init_email
    parsed_url = parse_email_url(app.config['EMAIL_URL'])
  File "/usr/src/app/.venv/lib/python3.9/site-packages/fittrackee/emails/utils_email.py", line 11, in parse_email_url
    raise InvalidEmailUrlScheme()
fittrackee.emails.exceptions.InvalidEmailUrlScheme
[2021-07-13 12:28:48 +0000] [9] [INFO] Worker exiting (pid: 9)
[2021-07-13 12:28:48 +0000] [8] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
    super().init_process()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/src/app/.venv/lib/python3.9/site-packages/gunicorn/util.py", line 412, in import_app
    app = app(*args, **kwargs)
  File "/usr/src/app/.venv/lib/python3.9/site-packages/fittrackee/__init__.py", line 50, in create_app
    email_service.init_email(app)
  File "/usr/src/app/.venv/lib/python3.9/site-packages/fittrackee/emails/email.py", line 83, in init_email
    parsed_url = parse_email_url(app.config['EMAIL_URL'])
  File "/usr/src/app/.venv/lib/python3.9/site-packages/fittrackee/emails/utils_email.py", line 11, in parse_email_url
    raise InvalidEmailUrlScheme()
fittrackee.emails.exceptions.InvalidEmailUrlScheme
[2021-07-13 12:28:48 +0000] [8] [INFO] Worker exiting (pid: 8)
[2021-07-13 12:28:48 +0000] [7] [WARNING] Worker with pid 9 was terminated due to signal 15
[2021-07-13 12:28:48 +0000] [7] [INFO] Shutting down: Master
[2021-07-13 12:28:48 +0000] [7] [INFO] Reason: Worker failed to boot.
SamR1 commented 3 years ago

Thanks for the logs.
It seems that the env variable EMAIL_URL is invalid or empty (see documentation):

  File "/usr/src/app/.venv/lib/python3.9/site-packages/fittrackee/emails/utils_email.py", line 11, in parse_email_url
    raise InvalidEmailUrlScheme()
fittrackee.emails.exceptions.InvalidEmailUrlScheme
jimbobcraig commented 3 years ago

yeah, that has sorted it, typo in that variable in my setup. thank you for the support.