Skip to content

Using Docker

Brian Teeman edited this page Nov 9, 2023 · 2 revisions

You can use Docker to run Panopticon. You can either use the published images, or build the latest image yourself.

Please note that Docker support is currently experimental. We are aware that updates may be problematic and are looking for a better way to implement them.

Using pre-built images

We publish a container image of the latest Panopticon release on GitHub Packages. It is available under the tag ghcr.io/akeeba/panopticon:latest.

To use it, you need to create a Docker Compose file (docker-compose.yml) which makes the requisite MySQL database instance available to it. For example:

version: "3.5"
services:
  php:
    image: "ghcr.io/akeeba/panopticon:latest"
    entrypoint: ["bash", "/usr/local/bin/docker-entrypoint.sh"]
    depends_on:
      mysql:
        condition: service_started
    links:
      - mysql
    ports:
      - 4280:80
      - 4443:443
    volumes:
      - ./user_code:/var/www/html/user_code
    container_name: panopticon_php
    restart: always
  mysql:
    image: mysql:8.0
    command:
      - --default-authentication-plugin=mysql_native_password
    restart: always
    volumes:
      - panopticon_mysql:/var/lib/mysql
    environment:
      TZ: "Europe/Berlin"
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
      MYSQL_DATABASE: "panopticon"
      MYSQL_USER: "panopticon"
      MYSQL_PASSWORD: "Emx6Rf9mtneXNgpZyehvdm8NUJJMJQA8"
    container_name: panopticon_mysql
volumes:
  panopticon_mysql:

This assumes that you have a folder named user_code in the same directory as docker-compose.yml where you will be storing your user code for advanced customization.

❗️ IMPORTANT Do not change the MySQL environment information. It is hardcoded in the entrypoint file (docker-entrypoint.sh) which is used to perform the initial installation. You can change these, and reconfigure Panopticon, after you have performed the initial installation.

Doing docker compose up -d will bring up the services. You can access Panopticon as http://localhost:4280.

Updates

⚠️ You may have to back up your config.php file before the update and restore it after the update. We are looking for a better solution.

Updating Panopticon is straightforward. Once a new image is available do:

docker compose restart
sleep 5
docker exec -it \`docker ps | grep panopticon-php | awk '{print $1}' | tail -n1\` su panopticon -c "/usr/local/bin/php /var/www/html/cli/panopticon.php database:update" 

Using the source

Clone Panopticon's repository, run composer install to import the dependencies, then run Docker Composer to bring up the services:

git clone https://github.com/akeeba/panopticon.git
cd panopticon
composer install
docker compose up -d

You can access Panopticon as http://localhost:4280.

If you want to modify the services in the docker-compose.yml file, for example to add a volume with your user_code, don't edit that file directly. Instead, create a docker-compose.override.yml as per Docker's documentation. We automatically exclude this file from the Git repository, making it safe to use without causing any problems to Git.

❗️ IMPORTANT Do not use the docker-run.sh script in the root of the repository. This script is for development purposes only. The first thing it does is docker compose down which deletes the service containers, including the database data.

Updates

⚠️ You may have to back up your config.php file before the update and restore it after the update. We are looking for a better solution.

Updating Panopticon is straightforward. Once a new version is available do:

TAGNAME=1.2.3
git checkout tags/$TAGNAME -b $TAGNAME
docker build --no-cache php
docker compose restart
sleep 5
docker exec -it \`docker ps | grep panopticon-php | awk '{print $1}' | tail -n1\` su panopticon -c "/usr/local/bin/php /var/www/html/cli/panopticon.php database:update" 

Change the first line (TAGNAME=1.2.3) to include the latest version's tag name. You can see that in the Releases page of the GitHub repository.

Login information

When you use the dockerized version of Panopticon a default Super Administrator user has been created for you with the username admin and the password admin. We strongly advise changing both the username and the password as soon as possible.

The default installation of Panopticon comes with email disabled. You should go to Administration, System Configuration to configure and enable email sending. Since you are running inside a container we strongly advise that you use SMTP.

Clone this wiki locally