Merge branch 'main' of github.com:ClusterCockpit/cc-docker

This commit is contained in:
Jan Eitzinger 2021-09-14 08:49:15 +02:00
commit 624f79a4ef

122
README.md
View File

@ -1,17 +1,18 @@
# cc-docker # cc-docker
This is a setup for `docker compose` to try out a complete ClusterCockpit Application Stack including all external components. This docker setup is intended for demo purposes, but can be easily configured to be used as a development environment for ClusterCockpit. This is a `docker compose` setup to try out the complete ClusterCockpit Application Stack including all external components. This docker setup can be easily configured to be used as demo or as a development environment.
It creates containers for: It includes the following containers:
* mysql * mysql
* php-fpm * php-fpm
* nginx * nginx
* redis * redis
* openldap * openldap
* influxdb (only in dev mode) * influxdb
* phpmyadmin (only in dev mode), this did not work with Chrome for me. * phpmyadmin
Ports and Passwords are configured in `.env`. Settings are configured in `.env`.
The setup comes with fixture data for a job archive, influxDB, mySQL, and a LDAP user directory.
## Known Issues ## Known Issues
@ -19,75 +20,60 @@ Ports and Passwords are configured in `.env`.
* You need to ensure that no other web server is running on port 80 (e.g. Apache2). If port 80 is already in use, edit NGINX_PORT environment variable in `.env`. * You need to ensure that no other web server is running on port 80 (e.g. Apache2). If port 80 is already in use, edit NGINX_PORT environment variable in `.env`.
* Existing VPN connections sometimes cause problems with docker. If `docker-compose` does not start up correctly, try disabling any active VPN connection. Refer to https://stackoverflow.com/questions/45692255/how-make-openvpn-work-with-docker for further information. * Existing VPN connections sometimes cause problems with docker. If `docker-compose` does not start up correctly, try disabling any active VPN connection. Refer to https://stackoverflow.com/questions/45692255/how-make-openvpn-work-with-docker for further information.
## Using for DEMO purpose ## Configuration
### Info
* The demo starts in Symfony production environment. While many aspects of this docker compose setup can be configured you usually only need to adapt the following three settings in `.env`:
* It uses prepared fixture data for databases (Changes will not be preserved). * `CLUSTERCOCKPIT_BRANCH` (Default: `develop`): The branch to checkout from ClusterCockpit git repository. May also be a tag.
* ClusterCockpit is checked out and initialized from scratch on every container start (Changes will not be preserved). * `APP_CLUSTERCOCKPIT_INIT` (Default: true): Wether the Symfony tree (located at `./data/symfony`) should be deleted and freshly cloned and initialized on every container startup.
* `APP_ENVIRONMENT` (Default: `dev`): The Symfony app environment. With `dev` you get the symfony debug toolbar and more extensive error handling. The `prod` environment is a setup for productions use.
## Setup
### Setup
The fixture data needs to be prepared once before first start of containers:
* `$ cd data` * `$ cd data`
* `$ ./init.sh` * `$ ./init.sh`: The script asks for sudo rights as the file ownership needs to changed for some folders. **NOTICE** The script will download files of a total size of 338MB (mostly for the InfluxDB data).
After that from the root of the repository you can start up the containers with: After that from the root of the cc-docker sandbox you can start up the containers with:
* `docker-compose up` * `$ docker-compose up`
* Wait... and wait a little longer * Wait... and wait a little longer
By default, you can access ClusterCockpit in your browser at http://localhost . If the `NGINX_PORT` environment variable was changed, use `http://localhost:$PORT` . Before you can use ClusterCockpit the following disclaimer must be shown. To download and build all ClusterCockpit components may take up to several minutes:
```
-------------------- ---------------------------------
Symfony
-------------------- ---------------------------------
Version 5.3.7
Long-Term Support No
End of maintenance 01/2022 (in +140 days)
End of life 01/2022 (in +140 days)
-------------------- ---------------------------------
Kernel
-------------------- ---------------------------------
Type App\Kernel
Environment dev
Debug true
Charset UTF-8
Cache directory ./var/cache/dev (6.5 MiB)
Build directory ./var/cache/dev (6.5 MiB)
Log directory ./var/log (249 B)
-------------------- ---------------------------------
PHP
-------------------- ---------------------------------
Version 8.0.10
Architecture 64 bits
Intl locale n/a
Timezone UTC (2021-09-13T09:41:33+00:00)
OPcache true
APCu false
Xdebug false
-------------------- ---------------------------------
```
Credentials for admin user are: By default, you can access ClusterCockpit in your browser at `http://localhost`. If the `NGINX_PORT` environment variable was changed, you have to use `http://localhost:$PORT` . You can shutdown the containers by pressing `CTRL-C`. Refer to the common docker documentation how to start the environment in the background.
## Usage
Credentials for the preconfigured admin user are:
* User: `admin` * User: `admin`
* Password: `AdminDev` * Password: `AdminDev`
You can shutdown the containers by pressing `CTRL-C`. You can also login as regular user using any credential in the LDAP user directory at `./data/ldap/users.ldif`.
To reuse an existing Symfony tree at `./data/symfony` you may change the environment variable `APP_CLUSTERCOCKPIT_INIT` in `.env` from `true` to `false`.
## Using for DEVELOP purpose
### Info
* The `APP_ENVIRONMENT` variable in `.env` is used to switch the `php-fpm` container to development environment.
* The `APP_CLUSTERCOCKPIT_INIT` variable in `.env` is used to prevent the container from initializing a new ClusterCockpit instance on every start.
* In this case, an existing Symfony tree at `./data/symfony` is required.
* By default, this also uses prepared fixture data for databases. In order to use an existing database, changes in `.env` and `docker-compose.yml` are required (see below).
### Setup
This description assumes you will let the docker setup initialize the symfony tree and data fixtures for you.
If not using an existing database, the fixture data needs to be prepared before the first start of the containers:
* `$ cd data`
* `$ ./init.sh dev`
In `.env`, change the following variables under `APP`
* `APP_ENVIRONMENT` to `dev`
In case you want to switch from Demo to Develop you have to purge previous images. This command will purge **ALL** your docker images:
```
$ docker images -a -q | xargs docker rmi -f
```
Check with:
```
$ docker images
```
that all images are gone.
After that from the root of the repository you can start up the containers with (use -d switch to startup in detached mode):
* `docker-compose -f docker-compose.yml -f docker-compose-dev.yml up`
* Wait... and wait a little longer
After the initial setup you have to:
* Comment or delete the line `- ${DATADIR}/sql:/docker-entrypoint-initdb.d` for `cc-db` to disable initialisation of the MySQL database.
* Set `APP_CLUSTERCOCKPIT_INIT` to `false` in the .env file
On subsequent start of the containers you will then reuse the persisted volume data located in the `./data` directory.
By default, you can access ClusterCockpit in your browser at `http://localhost`.
If `NGINX_PORT` environment variable was changed, `use http://localhost:$PORT`.
The InfluxDB Web interface can be accessed at `http://localhost:8086` using the credentials set in `.env`.
PHPMyAdmin can be reached at `http://localhost:8080`.
If default database fixture were used, the credentials for admin user are:
* User: `admin`
* Password: `AdminDev`
You can shutdown the containers by pressing `CTRL-C` if not started in detached mode.