Expose Influx port only in dev mode. Extend docs.

This commit is contained in:
Jan Eitzinger 2021-06-15 17:09:53 +02:00
parent f66a44ae5a
commit 3ac34e8885
4 changed files with 8 additions and 12 deletions

2
.env
View File

@ -3,7 +3,7 @@ DATADIR=./data
# APP # APP
######################################################################## ########################################################################
APP_CLUSTERCOCKPIT_INIT=true APP_CLUSTERCOCKPIT_INIT=true
APP_ENVIRONMENT=prod APP_ENVIRONMENT=prod #either prod or dev
######################################################################## ########################################################################
# MySQL # MySQL

View File

@ -49,31 +49,27 @@ To reuse an existing Symfony tree at `./data/symfony` you may change the environ
## Using for DEVELOP purpose ## Using for DEVELOP purpose
### Info ### Info
* `APP_ENVIRONMENT` variable in `.env` used to switch `php-fpm` container to development environment. * `APP_ENVIRONMENT` variable in `.env` used to switch `php-fpm` container to development environement.
* `APP_CLUSTERCOCKPIT_INIT` variable in `.env` used to prevent container from initializing a new ClusterCockpit instance on every start. * `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. * 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. In order to use an existing database, changes in `.env` and `docker-compose.yml` are required (see below).
* 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 ### Setup
If not using an existing database, the fixture data needs to be prepared before the first start of the containers: If not using an existing database, the fixture data needs to be prepared before the first start of the containers:
* `$ cd data` * `$ cd data`
* `$ ./init.sh` * `$ ./init.sh`
If an existing database is to be used, do the following: * Comment or delete the line `- ${DATADIR}/sql:/docker-entrypoint-initdb.d` for `cc-db` to disable initialisation of the MySQL database. You may also place your own MysQL database dump in `./data/sql`.
* It is recommended to use the included MySQL container.
* Uncomment the mapping of default volume paths in `docker-compose.yml` for `cc-db` and/or `cc-influxdb` under `volumes` to persist the data across container restarts.
* Comment or delete the line `- ${DATADIR}/sql:/docker-entrypoint-initdb.d` for `cc-db` to disable initialisation of the MySQL database. You may also place an own MysQL database dump in `./data/sql`.
In `.env`, change the following variables under `APP` In `.env`, change the following variables under `APP`
* `APP_CLUSTERCOCKPIT_INIT` to `false` * `APP_CLUSTERCOCKPIT_INIT` to `false`
* `APP_ENVIRONMENT` to `dev` * `APP_ENVIRONMENT` to `dev`
After that from the root of the repository you can start up the containers with: After that from the root of the repository you can start up the containers with:
* `docker-compose up` * `docker-compose -f docker-compose.yml -f docker-compose-dev.yml 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 NGINX_PORT environment variable was changed, use http://localhost:$PORT . 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: If default database fixture were used, the credentials for admin user are:
* User: `admin` * User: `admin`

View File

@ -4,6 +4,8 @@ services:
- ${DATADIR}/sql:/var/lib/mysql - ${DATADIR}/sql:/var/lib/mysql
influxdb: influxdb:
ports:
- "127.0.0.1:${INFLUXDB_PORT}:8086"
volumes: volumes:
- ${DATADIR}/influxdb/data:/var/lib/influxdb2 - ${DATADIR}/influxdb/data:/var/lib/influxdb2
- ${DATADIR}/influxdb/config:/etc/influxdb2 - ${DATADIR}/influxdb/config:/etc/influxdb2

View File

@ -17,8 +17,6 @@ services:
container_name: cc-influxdb container_name: cc-influxdb
image: influxdb image: influxdb
command: ["--reporting-disabled"] command: ["--reporting-disabled"]
ports:
- "127.0.0.1:${INFLUXDB_PORT}:8086"
environment: environment:
DOCKER_INFLUXDB_INIT_MODE: setup DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_USERNAME: symfony DOCKER_INFLUXDB_INIT_USERNAME: symfony