Giter Site home page Giter Site logo

Comments (10)

bmercernccer avatar bmercernccer commented on August 28, 2024 1

Thanks for the update. I was finally able to get back to this today. At first I had some issues updating the image, but then I realized there's a typo in the instructions. The update command should have an underscore.
docker pull jackjoe/mailgun_logger

Once I figured that out I was able to update the image and everything fired up without issue.

My logger is now up and running. I'm having some other problems, but they're unrelated to this issue, so I think it can be considered resolved.

from mailgun_logger.

jeroenbourgois avatar jeroenbourgois commented on August 28, 2024

@damianmytek I think there are some leftover bugs from our (very recent) migration from Postgres to MySQL. I will look into it asap and get back to you.

PS: I also updated our announcement article, have you tried following that?

from mailgun_logger.

damianmytek avatar damianmytek commented on August 28, 2024

Hi @jeroenbourgois thanks for getting back to me.
I updated docker-compose.yml:

version: "3"

services:
  db:
    image: mysql
    networks:
      - webnet
    environment:
      - MYSQL_PASSWORD=logger
      - MYSQL_USER=logger
      - MYSQL_DATABASE=mailgun_logger
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
    volumes:
      - db_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      timeout: 5s
      retries: 10

  web:
    image: jackjoe/mailgun_logger
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "5050:5050"
    networks:
      - webnet
    environment:
      ML_DB_USER: logger
      ML_DB_PASSWORD: logger
      ML_DB_NAME: mailgun_logger
      ML_DB_HOST: db

networks:
  webnet:
    external: false

volumes:
  db_data: {}

which is what i found in the announcement article.

Now i am getting this error:

ERROR: The Compose file './docker-compose.yml' is invalid because:
services.web.depends_on contains an invalid type, it should be an array

I am still learning on how to use docker so chances are that this is something on my end.
But i never run on the problem like this before.

I also tried deploying your package on a different server(synology with docker) but i am also getting errors.

Your project looks very interesting to me and i would love to test it.

Thanks,
Damian

from mailgun_logger.

jeroenbourgois avatar jeroenbourgois commented on August 28, 2024

@damianmytek ok, let's take this step by step. First, we need to address you docker-compose issue. I noticed that our readme was slightly different than the file we actually used, the 'ML_' env vars should be preceded with a dash. Here is the complete file again:

version: "3"

services:
  db:
    image: mysql
    networks:
      - webnet
    environment:
      - MYSQL_PASSWORD=logger
      - MYSQL_USER=logger
      - MYSQL_DATABASE=mailgun_logger
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
    volumes:
      - db_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      timeout: 5s
      retries: 10

  web:
    image: jackjoe/mailgun_logger
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "5050:5050"
    networks:
      - webnet
    environment:
      - ML_DB_USER: logger
      - ML_DB_PASSWORD: logger
      - ML_DB_NAME: mailgun_logger
      - ML_DB_HOST: db

networks:
  webnet:
    external: false

volumes:
  db_data: {}

Next, can you check the syntax by running docker-compose config? This should just output the yml file or show an error.

If that works we can continue from there.

from mailgun_logger.

bmercernccer avatar bmercernccer commented on August 28, 2024

I'm also a docker newbie, and I'm having the same problem.
When I run docker-compose config with the yaml file provided above, I get this error:

localadmin@docker:~$ docker-compose config
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.web.environment contains {"ML_DB_USER": "logger"}, which is an invalid type, it should be a string
services.web.depends_on contains an invalid type, it should be an array

I noticed that the syntax of the web environment was different from that of the db environment, so I tried changing

    environment:
      - ML_DB_USER: logger
      - ML_DB_PASSWORD: logger
      - ML_DB_NAME: mailgun_logger
      - ML_DB_HOST: db

to

    environment:
      - ML_DB_USER=logger
      - ML_DB_PASSWORD=logger
      - ML_DB_NAME=mailgun_logger
      - ML_DB_HOST=db

and that fixed the first part of the error. But I'm still getting

services.web.depends_on contains an invalid type, it should be an array

I noticed this in the documentation for depends_on...

There are several things to be aware of when using depends_on:

  • depends_on does not wait for db and redis to be β€œready” before starting web - only until they have been started. If you need to wait for a service to be ready, see Controlling startup order for more on this problem and strategies for solving it.
  • Version 3 no longer supports the condition form of depends_on.
  • The depends_on option is ignored when deploying a stack in swarm mode with a version 3 Compose file.

https://docs.docker.com/compose/compose-file/

I assume this is probably the cause, but I have no idea how to correct it.

from mailgun_logger.

bmercernccer avatar bmercernccer commented on August 28, 2024

I tried simply removing the condition clause from depends_on and that resolved the error, but I'm now having a variety of other errors. It seems the provided config has issues.

from mailgun_logger.

jeroenbourgois avatar jeroenbourgois commented on August 28, 2024

@bmercernccer I will get back to you asap, I will first get the suggested docker file myself. Can you tell me which version of docker you are using?

from mailgun_logger.

bmercernccer avatar bmercernccer commented on August 28, 2024

I'm using 19.03.13.

I was finally able to get the logger running, but had to make several changes.
Here's what I had to do.

  1. change the syntax of the web environment as mentioned previously.
  2. I completely removed the condition clause from web: depends-on. It works, but it doesn't fail gracefully if there's a DB issue, which caused some other problems for me.
  3. The container kept failing to start. Eventually I identified it as due to database errors, which I think were due to not waiting for the DB to fully start. Eventually I was able to get past this by repeatedly restarting the container until I got lucky.
  4. Once the service was running, I got timeout errors while actually retrieving the logs. I couldn't find a way to change this in the YAML config, so after a lot of googling and reading, I figured that I needed to change the timeout in the image.

I edited /opt/app/releases/0.0.4/runtime.exs. and added longer timeouts. I had no idea which one was correct so I just put all three of them in there.

Here's the final runtime.exs...

config :mailgun_logger, MailgunLogger.Repo,
  username: System.get_env("ML_DB_USER"),
  password: System.get_env("ML_DB_PASSWORD"),
  database: System.get_env("ML_DB_NAME"),
  hostname: System.get_env("ML_DB_HOST"),
  ownership_timeout: 120_000,
  timeout: 120_000,
  pool_timeout: 120_000

I then exited the shell and committed the change to a new image I called updated-mailgun_logger.
Then I updated the config and started the container, and it worked.

Here's the final docker-compose.yaml file...

version: "3"

services:
  db:
    image: mysql
    networks:
      - webnet
    environment:
      - MYSQL_PASSWORD=logger
      - MYSQL_USER=logger
      - MYSQL_DATABASE=mailgun_logger
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
    volumes:
      - db_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      timeout: 5s
      retries: 10

  web:
    image: updated-mailgun_logger
    depends_on:
      - db
    ports:
      - "5050:5050"
    networks:
      - webnet
    environment:
      - ML_DB_USER=logger
      - ML_DB_PASSWORD=logger
      - ML_DB_NAME=mailgun_logger
      - ML_DB_HOST=db

networks:
  webnet:
    external: false

volumes:
  db_data: {}

Hopefully this helps.

from mailgun_logger.

jeroenbourgois avatar jeroenbourgois commented on August 28, 2024

@bmercernccer thanks so much for your input. I updated the Docker image to have a wait-for program, in order for the web container to successfully wait for the db container. Your input regarding the docker-compose version was very helpful.

I tested it on my local machine with the updated docker-compose file, and it ran smoothly. Could you check again. For reference, here is the updated syntax, which also can be found in the readme file:

version: "3"

services:
  db:
    image: mysql
    networks:
      - webnet
    environment:
      - MYSQL_PASSWORD=logger
      - MYSQL_USER=logger
      - MYSQL_DATABASE=mailgun_logger
      - MYSQL_RANDOM_ROOT_PASSWORD=yes
    volumes:
      - db_data:/var/lib/mysql

  web:
    image: jackjoe/mailgun_logger
    depends_on:
      - db
    entrypoint: ["./wait-for", "db:3306", "--", "./start.sh"]
    ports:
      - "5050:5050"
    networks:
      - webnet
    environment:
      - ML_DB_USER=logger
      - ML_DB_PASSWORD=logger
      - ML_DB_NAME=mailgun_logger
      - ML_DB_HOST=db

networks:
  webnet:
    external: false

volumes:
  db_data: {}

Main difference is the entrypoint line for the web container. Love to hear your input.

PS

[REDACTED AFTER INPUT FROM @bmercernccer FOR FUTURE REFERENCE]

Be sure to update the jackjoe/mailgun-logger image before running docker-compose again. I just ran this first:

Be sure to update the jackjoe/mailgun_logger image before running docker-compose again. I just ran this first:

docker pull jackjoe/mailgun_logger

from mailgun_logger.

jeroenbourgois avatar jeroenbourgois commented on August 28, 2024

@bmercernccer thank you for bearing with us! I updated the instructions in the readme. Since you posted your issue, we started 'dogfooding' the same public docker image for a client of ours, so most bugs should be polished out now.

Happy logging!

from mailgun_logger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.