GithubHelp home page GithubHelp logo

HTTPS? about docker-joomla HOT 2 CLOSED

bokkenka avatar bokkenka commented on August 19, 2024
HTTPS?

from docker-joomla.

Comments (2)

Llewellynvdm avatar Llewellynvdm commented on August 19, 2024

The Joomla container works perfectly well along side Treafik, or any other egress routing software. Which is the easy and simplest way to connect a certificate to your website. I would normally achieve this on a server, with a static IP using the following composer file:

For Treafik

version: "3.3"

services:
  traefik:
    container_name: traefik
    image: "traefik:latest"
    command:
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
#      - --api.dashboard=true
#      - --api.insecure=true
      - --providers.docker
      - --log.level=INFO
      - --certificatesresolvers.joomlaresolver.acme.httpchallenge=true
      - --certificatesresolvers.joomlaresolver.acme.keytype=RSA4096
      - --certificatesresolvers.joomlaresolver.acme.email=youremail@address.com
      - --certificatesresolvers.joomlaresolver.acme.storage=/acme.json
      - --certificatesresolvers.joomlaresolver.acme.httpchallenge.entrypoint=web
      - --providers.file.directory=/conf
      - --providers.file.watch=true
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
#      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - "${JOOMLA_PROJECT_PATH}/traefik/conf:/conf"
      - "${JOOMLA_PROJECT_PATH}/traefik/acme.json:/acme.json"
      - "${JOOMLA_PROJECT_PATH}/traefik/errors:/errors"
    labels:
      # settings for all containers
      - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
      - "traefik.http.routers.http-catchall.entrypoints=web"
      - "traefik.http.routers.http-catchall.middlewares=redirect-to-me"
      - "traefik.http.middlewares.redirect-to-me.redirectscheme.scheme=https"
    networks:
      - traefik

networks:
  traefik:
    name: traefik_webgateway

For Joomla:

version: '2'
services:
  mariadb_your_project_name:
    image: mariadb:latest
    container_name: mariadb_your_project_name
    restart: unless-stopped
    environment:
      - MARIADB_DATABASE=${JOOMLA_YOUR_PROJECT_NAME_DB}
      - MARIADB_USER=${JOOMLA_YOUR_PROJECT_NAME_DB_USER}
      - MARIADB_PASSWORD=${JOOMLA_YOUR_PROJECT_NAME_DB_PASS}
      - MARIADB_ROOT_PASSWORD=${JOOMLA_YOUR_PROJECT_NAME_DB_ROOT}
    volumes:
      - "${JOOMLA_PROJECT_PATH}/your_project_name/db:/var/lib/mysql"
    networks:
      - traefik
  joomla_your_project_name:
    image: joomla:4.3
    container_name: joomla_your_project_name
    restart: unless-stopped
    environment:
      - APACHE_RUN_USER=#1000
      - APACHE_RUN_GROUP=#1000
      - JOOMLA_DB_HOST=mariadb_your_project_name:3306
      - JOOMLA_DB_NAME=${JOOMLA_YOUR_PROJECT_NAME_DB}
      - JOOMLA_DB_USER=${JOOMLA_YOUR_PROJECT_NAME_DB_USER}
      - JOOMLA_DB_PASSWORD=${JOOMLA_YOUR_PROJECT_NAME_DB_PASS}
    depends_on:
      - mariadb_your_project_name
    volumes:
      - "${JOOMLA_PROJECT_PATH}/your_project_name/joomla:/var/www/html"
      - "${JOOMLA_PROJECT_PATH}/your_project_name/php.ini:/var/www/html/php.ini"
    networks:
      - traefik
    labels:
      # joomla
      - "traefik.enable=true"
      - "traefik.http.routers.joomla_your_project_name.rule=Host(`www.domain.com`)"
      - "traefik.http.routers.joomla_your_project_name.entrypoints=websecure"
      - "traefik.http.routers.joomla_your_project_name.tls.certresolver=joomlaresolver"
      - "traefik.http.routers.joomla_your_project_name.service=joomla_your_project_name"
      - "traefik.http.services.joomla_your_project_name.loadbalancer.server.port=80"
#  phpmyadmin_your_project_name:
#    image: phpmyadmin/phpmyadmin
#    container_name: phpmyadmin_your_project_name
#    restart: unless-stopped
#    environment:
#      PMA_HOST: mariadb_your_project_name
#      PMA_PORT: 3306
#      UPLOAD_LIMIT: 300M
#    depends_on:
#      - mariadb_your_project_name
#    networks:
#      - traefik
#    labels:
#      # phpmyadmin
#      - "traefik.enable=true"
#      - "traefik.http.routers.phpmyadmin_your_project_name.rule=Host(`database.domain.com`)"
#      - "traefik.http.routers.phpmyadmin_your_project_name.entrypoints=websecure"
#      - "traefik.http.routers.phpmyadmin_your_project_name.tls.certresolver=joomlaresolver"
#      - "traefik.http.routers.phpmyadmin_your_project_name.service=phpmyadmin_your_project_name"
#      - "traefik.http.services.phpmyadmin_your_project_name.loadbalancer.server.port=80"

networks:
  traefik:
    name: traefik_webgateway

You will need to adapt this for your use case. I make use of Octojoom to manage all this for me.

from docker-joomla.

Llewellynvdm avatar Llewellynvdm commented on August 19, 2024

HEADS-UP

Please note, this line:

- "${JOOMLA_PROJECT_PATH}/traefik/acme.json:/acme.json

You must make sure that this file mounted to your parent system is a json file, and has the most secure access.

I would normally setup this file first before starting my traefik container:

sudo su -
JOOMLA_PROJECT_PATH='/home/path/to/secure/project/files'
echo '{}' > "${JOOMLA_PROJECT_PATH}/traefik/acme.json
chmod 600 "${JOOMLA_PROJECT_PATH}/traefik/acme.json
exit

Without this traefik will not be able to use that file, or create it correctly most of the time.

from docker-joomla.

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.