Skip to content

How do you run other containers with the traefik that this book sets up? #183

Open
@TonySerpofski

Description

I've set up a server using this playbook. Its running a few services (eg synthing) that ive chosen by adding to vars file and they all working behind traefik. Great. but im struggling to run other docker containers using the traefik thats installed.

I understand the doc to config the dns for eg syncthing - id go to https://mash.example.com/syncthing and it get the synthign UI. Great

But how do i get my website to be on the main domain https://example.com/ and have it running behind traefik?

Not sure how to get it working - new to Ansible with a few playbooks under my belt but this one is way more complicated

this is what id use to get the PrestaShop working usually:

services:
  mariadb:
    container_name: mariadb
    image: docker.io/bitnami/mariadb:latest
    environment:
      - ALLOW_EMPTY_PASSWORD=no
      - MARIADB_ROOT_PASSWORD=AzfrZEby2PKyyH59P
      - MARIADB_DATABASE=prestashop_2024
      - MARIADB_USER=example2024
      - MARIADB_PASSWORD=gyeGjEZ92obHWg#Y#d7
    volumes:
      - /home/user/bitnami/mariadb:/bitnami/mariadb
    networks:
      - prestashop-net

  prestashop:
    container_name: prestashop
    image: docker.io/bitnami/prestashop:latest
    environment:
      - PRESTASHOP_HOST=example.com
      - PRESTASHOP_TIMEZONE=Asia/Singapore
      - PRESTASHOP_DATABASE_HOST=mariadb
      - PRESTASHOP_DATABASE_PORT_NUMBER=3306
      - PRESTASHOP_DATABASE_USER=example2024
      - PRESTASHOP_DATABASE_NAME=prestashop_2024
      - PRESTASHOP_DATABASE_PASSWORD=gyeGjEZ92obHWg#Y#d7
      - PRESTASHOP_FIRST_NAME=user
      - PRESTASHOP_LAST_NAME=Nuser
      - PS_DEV_MODE=0
      - PS_DEMO_MODE=0
      - PS_FOLDER_ADMIN=admin076vwy4oc
      - [email protected]
      - [email protected]
      - PHP_UPLOAD_MAX_FILESIZE=0M
      - PHP_MEMORY_LIMIT=512M
      - ALLOW_EMPTY_PASSWORD=no
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.prestashop.rule=Host(`example.com`)"
      - "traefik.http.routers.prestashop.entrypoints=traefik"
      - "traefik.http.services.prestashop.loadbalancer.server.port=80"
    volumes:
      - /home/user/prestashop:/bitnami/prestashop
    depends_on:
      - mariadb
    networks:
      - prestashop-net
      - traefik

  phpmyadmin:
    container_name: myphpadmin
    image: phpmyadmin/phpmyadmin
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.phpmyadmin.rule=Host(`phpmyadmin.example.com`)"
      - "traefik.http.routers.phpmyadmin.entrypoints=traefik"
      - "traefik.http.services.phpmyadmin.loadbalancer.server.port=80"
    networks:
      - prestashop-net
      - traefik

networks:
  prestashop-net:
    external: true
  traefik:
    external: true

volumes:
  mariadb_data:
    driver: local
  prestashop_data:
    driver: local

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions