Prepare docker setup to use fixtures

This commit is contained in:
Jan Eitzinger 2021-06-09 09:53:35 +02:00
parent e4b8f2966c
commit ae68a9e110
8 changed files with 2263 additions and 34 deletions

4
.env
View File

@ -1,7 +1,7 @@
DATADIR=./data
######################################################################## ########################################################################
# MySQL # MySQL
######################################################################## ########################################################################
MYSQL_PORT=3307
MYSQL_ROOT_PASSWORD=root MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=symfony MYSQL_DATABASE=symfony
MYSQL_USER=symfony MYSQL_USER=symfony
@ -17,11 +17,9 @@ INFLUXDB_ADMIN_TOKEN=egLfcf7fx0FESqFYU3RpAAbj
######################################################################## ########################################################################
# PHP # PHP
######################################################################## ########################################################################
PHP_PORT=9000
PHP_XDEBUG_MODE=off PHP_XDEBUG_MODE=off
PHP_XDEBUG_CLIENT_PORT=5902 PHP_XDEBUG_CLIENT_PORT=5902
PHP_XDEBUG_CLIENT_HOST=host.docker.internal PHP_XDEBUG_CLIENT_HOST=host.docker.internal
CLUSTERCOCKPIT_BRANCH=feature-47-introduce-graphql-api
######################################################################## ########################################################################
# PHPMyAdmin # PHPMyAdmin

View File

@ -35,3 +35,20 @@ TODOS (There are probably a lot more!):
* Some of the Volume directories need to be created first. * Some of the Volume directories need to be created first.
* ClusterCockpit is at the moment still using the influxDB V1 API, the InfluxDB container is already V2 * ClusterCockpit is at the moment still using the influxDB V1 API, the InfluxDB container is already V2
* For a running demo database fixtures for MySQL and InfluxDB are missing * For a running demo database fixtures for MySQL and InfluxDB are missing
## Using for DEMO purpose
Before starting the containers the fixture data needs to be prepared:
* `$ 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
You can access ClusterCockpit in your browser at http://localhost .
Credentials for admin user are:
* User: `admin`
* Password: `AdminDev`
Nothing is preserved! After shutting down the container everything is initialized from scratch.

6
data/init.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
mkdir symfony
wget https://hpc-mover.rrze.uni-erlangen.de/HPC-Data/0x7b58aefb/eig7ahyo6fo2bais0ephuf2aitohv1ai/job-archive.tar.bz2
tar xjf job-archive.tar.bz2
rm ./job-archive.tar.bz2

2216
data/sql/ClusterCockpit.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,15 @@
version: '1.0'
services: services:
db: db:
container_name: db container_name: db
image: mysql:8.0.22 image: mysql:8.0.22
command: ["--default-authentication-plugin=mysql_native_password"] command: ["--default-authentication-plugin=mysql_native_password"]
ports:
- "${MYSQL_PORT}:3306"
environment: environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ClusterCockpit MYSQL_DATABASE: ClusterCockpit
MYSQL_USER: symfony MYSQL_USER: symfony
MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes: volumes:
- ./sql:/var/lib/mysql - ${DATADIR}/sql:/docker-entrypoint-initdb.d
influxdb: influxdb:
container_name: influxdb container_name: influxdb
@ -28,9 +25,6 @@ services:
DOCKER_INFLUXDB_INIT_BUCKET: ClusterCockpit DOCKER_INFLUXDB_INIT_BUCKET: ClusterCockpit
DOCKER_INFLUXDB_INIT_RETENTION: 2w DOCKER_INFLUXDB_INIT_RETENTION: 2w
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_ADMIN_TOKEN} DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_ADMIN_TOKEN}
volumes:
- ./influxdb/data:/var/lib/influxdb2
- ./influxdb/config:/etc/influxdb2
php: php:
container_name: php-fpm container_name: php-fpm
@ -43,10 +37,11 @@ services:
SYMFONY_CLI_VERSION: 4.23.2 SYMFONY_CLI_VERSION: 4.23.2
MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_PASSWORD: ${MYSQL_PASSWORD}
INFLUXDB_PASSWORD: ${INFLUXDB_PASSWORD} INFLUXDB_PASSWORD: ${INFLUXDB_PASSWORD}
ports: environment:
- "${PHP_PORT}:9001" - DOCKER_CLUSTERCOCKPIT_INIT=true
volumes: volumes:
- ./symfony:/var/www/symfony - ${DATADIR}/symfony:/var/www/symfony:cached
- ${DATADIR}/job-archive:/var/lib/job-archive:cached
depends_on: depends_on:
- db - db
- influxdb - influxdb
@ -80,5 +75,4 @@ services:
- NGINX_ENVSUBST_TEMPLATE_SUFFIX=.template - NGINX_ENVSUBST_TEMPLATE_SUFFIX=.template
- NGINX_SYMFONY_SERVER_NAME=${NGINX_SYMFONY_SERVER_NAME} - NGINX_SYMFONY_SERVER_NAME=${NGINX_SYMFONY_SERVER_NAME}
volumes: volumes:
- ./logs/nginx:/var/log/nginx - ${DATADIR}/symfony:/var/www/symfony:cached
- ./symfony:/var/www/symfony

View File

@ -18,7 +18,4 @@ server {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off; fastcgi_param HTTPS off;
} }
error_log /var/log/nginx/symfony_error.log;
access_log /var/log/nginx/symfony_access.log;
} }

View File

@ -66,15 +66,15 @@ RUN wget https://github.com/symfony/cli/releases/download/v$SYMFONY_CLI_VERSION/
RUN apk add --update nodejs npm \ RUN apk add --update nodejs npm \
&& npm install --global yarn && npm install --global yarn
RUN mkdir -p /var/lib/job-archive
RUN mkdir -p /var/www/symfony RUN mkdir -p /var/www/symfony
VOLUME /var/www/symfony VOLUME /var/www/symfony /var/lib/job-archive
COPY symfony.ini /etc/php8/conf.d/ COPY symfony.ini /etc/php8/conf.d/
COPY symfony.ini /etc/php8/cli/conf.d/ COPY symfony.ini /etc/php8/cli/conf.d/
COPY symfony.pool.conf /etc/php8/php-fpm.d/ COPY symfony.pool.conf /etc/php8/php-fpm.d/
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENV APP_ENV=prod ENV APP_ENV=prod
ENV APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629 ENV APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629
@ -86,6 +86,8 @@ ENV DATABASE_URL=mysql://symfony:${MYSQL_PASSWORD}@db:3306/ClusterCockpit
ENV CORS_ALLOW_ORIGIN=^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?$ ENV CORS_ALLOW_ORIGIN=^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?$
WORKDIR /var/www/symfony WORKDIR /var/www/symfony
EXPOSE 9001
CMD ["php-fpm8", "-F"]
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm8", "-F"]
EXPOSE 9001

View File

@ -1,17 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
rm -rf /var/www/symfony/* /var/www/symfony/.* if [ -n "${DOCKER_CLUSTERCOCKPIT_INIT}" ]; then
cd /var/www/symfony rm -rf /var/www/symfony/* /var/www/symfony/.??*
git clone https://github.com/ClusterCockpit/ClusterCockpit .
git init
git remote add origin https://github.com/ClusterCockpit/ClusterCockpit.git
git fetch
git checkout feature-47-introduce-graphql-api
composer install --no-dev --no-progress --optimize-autoloader composer install --no-dev --no-progress --optimize-autoloader
yarn install yarn install
yarn encore production yarn encore production
php bin/console doctrine:schema:create --no-interaction #php bin/console doctrine:schema:create --no-interaction
#php bin/console doctrine:migrations:migrate --no-interaction #php bin/console doctrine:migrations:migrate --no-interaction
#php bin/console doc:fix:load --no-interaction #php bin/console doctrine:fix:load --no-interaction
ln -s /var/lib/job-archive var/job-archive
fi
exec "$@" exec "$@"