Skip to content

Latest commit

 

History

History
166 lines (123 loc) · 4.85 KB

docker.md

File metadata and controls

166 lines (123 loc) · 4.85 KB

Deploy in production with Docker

This document explains how to install Bileto with Docker. Learn how to install Bileto with a “standard” setup.

In this documentation, it is expected that you're at ease with Docker. We only provide instructions for a basic setup. You will need to adapt the instructions to your needs, for instance to setup a reverse proxy, or reuse an existing database.

Warning: Bileto is not ready for the production yet, but it should be soon!

Installation

Install Docker

First, you must install Docker. Read how to install Docker.

Make sure that you also have Docker Compose v2 installed:

$ docker --version
Docker version 24.0.6, build ed223bc
$ docker compose version
Docker Compose version v2.21.0

Choose an image tag

At the moment, we provide two kind of Docker image tags:

  • versions tags (e.g. 0.5.0-alpha), corresponding to the Bileto releases;
  • the edge tag, corresponding to the main Git branch.

In most cases, you should select a version tag corresponding to a specific release. The edge tag can be used if you like to live dangerously, or if you want to try out the latest features of Bileto.

We don't provide a latest tag yet.

See the list of tagged images.

Create the Docker Compose environment

Create a folder with two files:

$ mkdir bileto
$ cd bileto
$ touch docker-compose.yml
$ touch .env.app

Add the following YAML in your docker-compose.yml. You'll need to adapt its content.

services:
    bileto:
        image: ghcr.io/probesys/bileto:0.5.0-alpha
        restart: unless-stopped
        ports:
            - "8000:80"
        volumes:
            - uploads:/var/www/html/uploads
            - var:/var/www/html/var
        env_file:
            - .env.app
        depends_on:
            database:
                condition: service_healthy
        healthcheck:
            test: ["CMD", "test", "-f", "/tmp/healthy.txt"]
            interval: 5s
            retries: 30

    worker:
        image: ghcr.io/probesys/bileto:0.5.0-alpha
        restart: unless-stopped
        command: php bin/console messenger:consume async scheduler_default -vv
        entrypoint: ""
        volumes:
            - uploads:/var/www/html/uploads
            - var:/var/www/html/var
        env_file:
            - .env.app
        depends_on:
            database:
                condition: service_healthy
            bileto:
                condition: service_healthy

    database:
        image: mariadb:10.11
        restart: unless-stopped
        environment:
            - MARIADB_ROOT_PASSWORD=secret
            - MARIADB_DATABASE=bileto
        healthcheck:
            test: ["CMD", "/usr/local/bin/healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized"]
            interval: 5s
            retries: 30

volumes:
    uploads:
    var:

Then, copy the content of the env.sample file in the .env.app file. In particular, you'll need to adapt the following variables:

APP_SECRET=change-me
DATABASE_URL="mysql://root:secret@database:3306/bileto?serverVersion=10.11.5-MariaDB"
MAILER_DSN=smtp://user:[email protected]:465
MAILER_FROM=[email protected]

Start the Docker containers

Then, you have to start the containers:

$ docker compose up

If everything is correctly configured, the database will start first, then Bileto, and finally the worker container.

Migrations are automatically executed when starting the Bileto container. They are performed in the entrypoint (it is reset for the worker container to avoid executing the migrations twice). Learn how the Docker images work.

You should be able to access Bileto at your.ip.address:8000.

Create a user

You must create your first user with the command line:

$ docker compose exec bileto php bin/console app:users:create [email protected] --password=secret

Important note: users created with the command line have "super-admin" permissions and can do anything in Bileto.

Then, try to login via the interface, it should work. You can start using Bileto now.

Next steps

You may want to complete your setup with additional steps:

Updating Bileto

Please always start by checking the migration notes in the changelog before updating Bileto.

Then, change the Docker image tag to the wanted version.

Pull the changes and restart the containers:

$ docker compose pull
$ docker compose restart