From 3ac34e8885be98ed778c848570ba543ccf2b0c71 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Tue, 15 Jun 2021 17:09:53 +0200 Subject: [PATCH] Expose Influx port only in dev mode. Extend docs. --- .env | 2 +- README.md | 14 +++++--------- docker-compose-dev.yml | 2 ++ docker-compose.yml | 2 -- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.env b/.env index e9541f7..b349311 100644 --- a/.env +++ b/.env @@ -3,7 +3,7 @@ DATADIR=./data # APP ######################################################################## APP_CLUSTERCOCKPIT_INIT=true -APP_ENVIRONMENT=prod +APP_ENVIRONMENT=prod #either prod or dev ######################################################################## # MySQL diff --git a/README.md b/README.md index 5a18d2d..706a9a8 100644 --- a/README.md +++ b/README.md @@ -49,31 +49,27 @@ To reuse an existing Symfony tree at `./data/symfony` you may change the environ ## Using for DEVELOP purpose ### 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. * 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). +* 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 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: -* 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`. +* 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`. 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` +* `docker-compose -f docker-compose.yml -f docker-compose-dev.yml 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 . +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` diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index d5b3397..94b0cfa 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -4,6 +4,8 @@ services: - ${DATADIR}/sql:/var/lib/mysql influxdb: + ports: + - "127.0.0.1:${INFLUXDB_PORT}:8086" volumes: - ${DATADIR}/influxdb/data:/var/lib/influxdb2 - ${DATADIR}/influxdb/config:/etc/influxdb2 diff --git a/docker-compose.yml b/docker-compose.yml index 7ab0dea..59adc3c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,8 +17,6 @@ services: container_name: cc-influxdb image: influxdb command: ["--reporting-disabled"] - ports: - - "127.0.0.1:${INFLUXDB_PORT}:8086" environment: DOCKER_INFLUXDB_INIT_MODE: setup DOCKER_INFLUXDB_INIT_USERNAME: symfony