cytopia / devilbox

A modern Docker LAMP stack and MEAN stack for local development
http://devilbox.org
MIT License
4.4k stars 654 forks source link

[Feature]: Add jasperreport addionnal container #905

Open hielh opened 2 years ago

hielh commented 2 years ago

What is your idea or feature suggestion?

Our need in one of our project is to use Jasperreport

Benefits

By default devilbox doesn't content any container of Jasperreport. I tried to use another docker image from bitnami: https://github.com/bitnami/bitnami-docker-jasperreports/blob/master/docker-compose.yml

But I get an error of: port is already in use, I changed the port to 8080:8080, but there is another problem of connexion with database.

I can't acces to jasperreport from localhost:8080

How could we use this docker image as container of devilbox

Where can we find information about this?

https://github.com/TIBCOSoftware/JS-Docker

Are you willing to provide a PR to address this?

No response

hielh commented 2 years ago

Update

I Installed the container of bitnami on devilbox using this code below:

  #   mariadb & jasperreports
  #  ____________________________________________________________________________
  mariadb:
    image: mariadb:latest
    ports:
      - 3306:3306
    volumes:
      - ~/apps/mariadb:/var/lib/mysql
    networks:
      app_net:
        ipv4_address: 172.16.238.251
    environment:
      - MYSQL_ROOT_PASSWORD=S3cret
      - MYSQL_PASSWORD=An0thrS3crt
      - MYSQL_USER=jasperserver
      - MYSQL_DATABASE=jasper_db
  jasperreports:
    image: docker.io/bitnami/jasperreports:latest
    ports:
      - '8080:8080'
    # The line below allows you to provide your own JasperReports configuration files, to be copied to WEB-INF
    # - "./config:/bitnami/jasperreports-mounted-conf"
    depends_on:
      - mariadb
    networks:
      app_net:
        ipv4_address: 172.16.238.250
    environment:
      # ALLOW_EMPTY_PASSWORD is recommended only for development.
      - JASPERREPORTS_DATABASE_HOST=mariadb
      - JASPERREPORTS_DATABASE_PORT_NUMBER=3306
      - JASPERREPORTS_DATABASE_USER=root
      - JASPERREPORTS_DATABASE_PASSWORD=S3cret
      - JASPERREPORTS_DATABASE_NAME=jasper_db`

But how could we use curl to call the api service.

hielh commented 2 years ago

the problem is if I'm using postman to get my result from Rest services:

The result from postman: image

but using php code from devilbox I get : image

Failed to connect to jasperreports.loc port 8080: Connection refused

hielh commented 2 years ago

@cytopia any help please why I can't call my jasperreport container from php container. image

cytopia commented 2 years ago

@hielh localhost is not going to work, as this is the localhost service of the PHP container and there is no jasperreport service running. You should try either:

  1. curl -I http://172.16.238.250:8080
  2. Or add a forwarder to jasperreport here: https://github.com/cytopia/devilbox/blob/master/docker-compose.yml#L147 (ofc you can use the override file to stay clean with git) and then be able to use localhost inside the PHP container
gregfr commented 2 years ago

Just a question you might want to ask yourself, is your use of JasperReport linked to your use of DevilBox? If not, you probably better keep DevilBox for what it is very good at, namely to deal with LAMP versions, and use something like Portainer for the rest of the Docker-related products.