add DEVELOP case options and update README.md

This commit is contained in:
Christoph Kluge 2021-06-11 13:44:51 +02:00
parent 3f9265bb7e
commit 9a465e7018
5 changed files with 60 additions and 11 deletions

6
.env
View File

@ -1,4 +1,10 @@
DATADIR=./data
########################################################################
# APP
########################################################################
APP_CLUSTERCOCKPIT_INIT=true
APP_ENVIRONMENT=prod
########################################################################
# MySQL
########################################################################

View File

@ -36,17 +36,23 @@ TODOS (There are probably a lot more!):
* ClusterCockpit is at the moment still using the influxDB V1 API, the InfluxDB container is already V2
* For a complete demo database setup, InfluxDB data fixtures are missing (MySQL demo database is available)
## Using for DEMO purpose
## Known Issues
Before starting the containers the fixture data needs to be prepared:
* `$ cd data`
* `$ ./init.sh`
Known Issues:
* `docker-compose` installed on Ubuntu (18.04, 20.04) via `apt-get` can not correctly parse `docker-compose.yml` due to version differences. Install latest version of `docker-compose` from https://docs.docker.com/compose/install/ instead.
* 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.
## Using for DEMO purpose
### Info
* Demo starts in production environment.
* Uses prepared fixture data for databases (Changes will not be preserved).
* ClusterCockpit will be initialized from scratch on every start (Changes will not be preserved).
### Setup
The fixture data needs to be prepared before the first start of the containers:
* `$ cd data`
* `$ ./init.sh`
After that from the root of the repository you can start up the containers with:
* `docker-compose up`
* Wait... and wait a little longer
@ -58,6 +64,39 @@ Credentials for admin user are:
* Password: `AdminDev`
You can shutdown the containers by pressing `CTRL-C`.
Nothing is preserved! After shutting down the container everything is initialized from scratch.
To reuse an existing Symfony tree at `./data/symfony` you may remove the environment variable `DOCKER_CLUSTERCOCKPIT_INIT` in `docker-composer.yml` file.
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
* `APP_ENVIRONMENT` variable in `.env` used to switch `php-fpm` container to development environment.
* `APP_CLUSTERCOCKPIT_INIT` variable in `.env` used to prevent container from initializing a new ClusterCockpit instance on every start.
* In this case, an existing Symfony tree at `./data/symfony` is required.
* Due to additional dependencies of the development environment, the instance has to be prepared with `composer` and `yarn` devel-options.
* By default, this also uses prepared fixture data for databases (Changes will not be preserved). In order to use an existing database, changes in `.env` and `docker-compose.yml` are required (see below).
### Setup
If not using an existing database, the fixture data needs to be prepared before the first start of the containers:
* `$ cd data`
* `$ ./init.sh`
If an existing database is to be used, do the following:
* Change variables under `MySQL` and/or `INFLUXDB` in `.env` to match the credentials of your database(s).
* Uncomment the mapping of default volume paths in `docker-compose.yml` for `cc-db` and/or `cc-influxdb` under `volumes`.
* Comment or delete the line `- ${DATADIR}/sql:/docker-entrypoint-initdb.d` for `cc-db`.
In `.env`, change the following variables under `APP`
* `APP_CLUSTERCOCKPIT_INIT` to `false`
* `APP_ENVIRONMENT` to `dev`
After that from the root of the repository you can start up the containers with:
* `docker-compose up`
* Wait... and wait a little longer
By default, you can access ClusterCockpit in your browser at http://localhost . If NGINX_PORT environment variable was changed, use http://localhost:$PORT .
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`.

View File

@ -41,8 +41,9 @@ services:
SYMFONY_CLI_VERSION: 4.23.2
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
INFLUXDB_PASSWORD: ${INFLUXDB_PASSWORD}
APP_ENVIRONMENT: ${APP_ENVIRONMENT}
environment:
- DOCKER_CLUSTERCOCKPIT_INIT=true
- APP_CLUSTERCOCKPIT_INIT=${APP_CLUSTERCOCKPIT_INIT}
volumes:
- ${DATADIR}/symfony:/var/www/symfony:cached
- ${DATADIR}/job-archive:/var/lib/job-archive:cached

View File

@ -76,7 +76,8 @@ COPY symfony.ini /etc/php8/cli/conf.d/
COPY symfony.pool.conf /etc/php8/php-fpm.d/
COPY entrypoint.sh /entrypoint.sh
ENV APP_ENV=prod
ARG APP_ENVIRONMENT
ENV APP_ENV=${APP_ENVIRONMENT}
ENV APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629
ENV APP_DEBUG=1
ARG INFLUXDB_PASSWORD

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
if [ -n "${DOCKER_CLUSTERCOCKPIT_INIT}" ]; then
if [ "$APP_CLUSTERCOCKPIT_INIT" = true ]; then
rm -rf /var/www/symfony/* /var/www/symfony/.??*
git clone https://github.com/ClusterCockpit/ClusterCockpit .
@ -13,4 +13,6 @@ if [ -n "${DOCKER_CLUSTERCOCKPIT_INIT}" ]; then
ln -s /var/lib/job-archive var/job-archive
fi
php bin/console about
exec "$@"