# Docker

> Run the development containers of Easy!Appointments with Docker and Docker Compose.

Source: https://easyappointments.org/documentation/docker/

Run the development containers of Easy!Appointments with Docker and Docker Compose utility. Docker allows you to compose your application in microservices, so that you can easily get started with the local development.

Simply [clone the project](https://github.com/alextselegidis/easyappointments) and run `docker compose up` to start the environment.

You will need copy `config-sample.php` modify the root `config.php` so that it matches the following example:

```php
class Config {
    // ----------------------------------------------------------
    // GENERAL SETTINGS
    // ----------------------------------------------------------

    const BASE_URL      = 'http://localhost'; 
    const LANGUAGE      = 'english';
    const DEBUG_MODE    = TRUE;

    // ----------------------------------------------------------
    // DATABASE SETTINGS
    // ----------------------------------------------------------

    const DB_HOST       = 'mysql';
    const DB_NAME       = 'easyappointments';
    const DB_USERNAME   = 'user';
    const DB_PASSWORD   = 'password';

    // ----------------------------------------------------------
    // GOOGLE CALENDAR SYNC (Optional - can also be configured via UI)
    // ----------------------------------------------------------

    // const GOOGLE_SYNC_FEATURE = false;
    // const GOOGLE_CLIENT_ID = '';
    // const GOOGLE_CLIENT_SECRET = '';
}
```

The Google constants are commented out on purpose: they are optional fallbacks. Set the Google Calendar credentials in the backend under **Settings → Integrations → Google Calendar** instead.

In the host machine the server is accessible from `http://localhost` and the database from `localhost:3306`.

You can additionally access phpMyAdmin from `http://localhost:8080` (credentials are `root` / `secret`) and Mailpit from `http://localhost:8025`.

Swagger UI, loaded with the project's `openapi.yml`, is available on `http://localhost:8000`.

Baikal, a self-hosted CalDAV server used to develop the CalDAV syncing integration is available on `http://localhost:8100` (credentials are `admin` / `admin`).

While activating CalDAV sync with the local Docker-based Baikal, you will need to first create a new Baikal user and then use those credentials together with the full calendar URL, `http://baikal/dav.php/calendars/<your-username>/default/`. A bare `http://baikal/dav.php` will not connect.

Openldap is configured to run through `openldap` container and ports `389` and `636`.

phpLdapAdmin, an admin portal for openldap is available on `http://localhost:8200` (credentials are `cn=admin,dc=example,dc=org` / `admin`).

### Behind a reverse proxy

If the container runs behind a reverse proxy, set the `PROXY_IPS` environment variable on it so the application trusts the forwarded headers and sees each visitor's real address:

```ini
PROXY_IPS=172.18.0.0/16
```

It takes a single address, a comma separated list, or a CIDR range. Leave it unset when nothing proxies the container - otherwise every visitor counts as the same client for rate limiting.

**Attention:** This configuration is meant to make development easier. It is not intended to server as a production environment!

A production image of Easy!Appointments can be found here: 

[https://github.com/alextselegidis/easyappointments-docker](https://github.com/alextselegidis/easyappointments-docker)

For more development info check the GitHub documentation files:

[https://github.com/alextselegidis/easyappointments/tree/main/docs](https://github.com/alextselegidis/easyappointments/tree/main/docs)
