Hello everyone, I'm trying to deploy a Grails app...
# questions
r
Hello everyone, I'm trying to deploy a Grails application as a runnable war file in a Docker container - the application appears to startup correctly according to the log messages, but when I try to connect to it, I get an empty response. Has anyone encountered this problem before or have any suggestions? I suspect the problem may have something to do with the fact that the Grails application is running on a non-standard port - is there some extra configuration step that I'm missing? Thanks, Robert
g
I used docker java image to do this all the time. I do not believe there are particular settings you need to do. Here are generally what I do: 1. Correctly export the correct PORT via docker-compose or Dockerfile 2. Map the app’s configuration folder and log folder to the the host machine 3. Use docker exec to log into the container. and use curl or anything can help to make sure the app really started 4. If you have multi docker services running all together, say, nginx, database, redis… , I would run them all in a same docker network(say, my-big-network), and then change the urls IP address to the internal IP or the container name.
r
Thank you for your reply - I've used docker exec to confirm that my application is definitely running insider the container but for some reason it's not accepting connections from my host, which suggests an issue with the port mapping or docker network
👍 1
@gaolei By the way, which version of Grails are you using? I've confirmed that I can run a Grails 4 application in Docker by following the instructions here, but I've not yet managed to get it working for Grails 6.1. https://guides.grails.org/grails4/grails-as-docker-container/guide/index.html
g
I am using the latest. 6.1.2
I am using docker compose, here is piece of the docker compose file I am using I configured the config to /opt/prod/[host_vol]/conf, and in the sh file, I specified the external configuration file
Copy code
one-of-the-app-server:
    image: openjdk:17
    container_name: [my-own-container]
    restart: unless-stopped
    command: sh /opt/prod/[host_vol]/docker_run_xx_app.sh start
    tty: true
    ports:
      - "8182:8182"
    expose:
      - 8182
    environment:
      - "VIRTUAL_HOST=<http://xxx.xxx.com|xxx.xxx.com>"
      - "VIRTUAL_PORT=8182"
      - "LETSENCRYPT_HOST=<http://xxx.xxx.com|xxx.xxx.com>"
      - "LETSENCRYPT_EMAIL=xxxxx_admin@gmail.com"
    volumes:
      - ./cotainer_vol:/opt/prod/[host_vol]
      - ./logs:/opt/prod/logs
r
Thank. you - that's very helpful
👍 1
g
You can ignore the environment section if you do not use nginx reverse proxy, I am using https://github.com/nginx-proxy/nginx-proxy to proxy my app to that public domain.
r
@gaolei Thanks for your help - I finally found. the problem with my Docker setup this morning. My
runtime.groovy
configured the server address as 127.0.0.1, which was interpreted relative to the Docker network, so everything was working correctly within the Docker container, but connections from the host disappeared into a black hole.
👍 1