diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..c0ebe0742 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,234 @@ +version: "2.4" + +services: + + traefik: + image: "traefik:v2.2" + container_name: "traefik_ems" + command: + #- "--log.level=DEBUG" + - "--api.insecure=true" + - "--providers.docker=true" + - "--providers.docker.exposedbydefault=false" + - "--entrypoints.web.address=:80" + - "--entrypoints.websecure.address=:443" + ports: + - "80:80" + - "443:443" + - "8888:8080" + volumes: + - "/var/run/docker.sock:/var/run/docker.sock:ro" + +# This image is a small and easy application to test traefik's configuration +# whoami: +# image: "containous/whoami" +# container_name: "simple-service" +# labels: +# - "traefik.enable=true" +# - "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)" +# - "traefik.http.routers.whoami.entrypoints=web" +# - "traefik.http.routers.whoami-tls.tls=true" +# - "traefik.http.routers.whoami-tls.rule=Host(`whoami.localhost`)" +# - "traefik.http.routers.whoami-tls.entrypoints=websecure" + + es01: + image: docker.elastic.co/elasticsearch/elasticsearch:7.11.2 + container_name: es01 + environment: + - node.name=es01 + - cluster.name=es7-docker-cluster + - discovery.seed_hosts=es02,es03 + - cluster.initial_master_nodes=es01,es02,es03 + - cluster.routing.allocation.disk.threshold_enabled=false + - bootstrap.memory_lock=true + - node.store.allow_mmap=false + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + ulimits: + memlock: + soft: -1 + hard: -1 + ports: + - 9200:9200 + volumes: + - data01:/usr/share/elasticsearch/data + labels: + - "traefik.enable=true" + - "traefik.http.routers.es.rule=Host(`es.localhost`)" + - "traefik.http.routers.es.entrypoints=web" + - "traefik.http.routers.es.service=es" + - "traefik.http.services.es.loadbalancer.server.port=9200" + es02: + image: docker.elastic.co/elasticsearch/elasticsearch:7.11.2 + container_name: es02 + environment: + - node.name=es02 + - cluster.name=es7-docker-cluster + - discovery.seed_hosts=es01,es03 + - cluster.initial_master_nodes=es01,es02,es03 + - cluster.routing.allocation.disk.threshold_enabled=false + - bootstrap.memory_lock=true + - node.store.allow_mmap=false + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + ulimits: + memlock: + soft: -1 + hard: -1 + volumes: + - data02:/usr/share/elasticsearch/data + labels: + - "traefik.enable=true" + - "traefik.http.routers.es.rule=Host(`es.localhost`)" + - "traefik.http.routers.es.entrypoints=web" + - "traefik.http.routers.es.service=es" + - "traefik.http.services.es.loadbalancer.server.port=9200" + es03: + image: docker.elastic.co/elasticsearch/elasticsearch:7.11.2 + container_name: es03 + environment: + - node.name=es03 + - cluster.name=es7-docker-cluster + - discovery.seed_hosts=es01,es02 + - cluster.initial_master_nodes=es01,es02,es03 + - cluster.routing.allocation.disk.threshold_enabled=false + - bootstrap.memory_lock=true + - node.store.allow_mmap=false + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + ulimits: + memlock: + soft: -1 + hard: -1 + volumes: + - data03:/usr/share/elasticsearch/data + labels: + - "traefik.enable=true" + - "traefik.http.routers.es.rule=Host(`es.localhost`)" + - "traefik.http.routers.es.entrypoints=web" + - "traefik.http.routers.es.service=es" + - "traefik.http.services.es.loadbalancer.server.port=9200" + + kibana: + container_name: kibana + image: docker.elastic.co/kibana/kibana:7.9.2 + ports: + - 5601:5601 + environment: + - TZ=Europe/Brussels + - ELASTICSEARCH_HOSTS=http://es01:9200 + - SERVER_NAME=kibana.localhost + labels: + - "traefik.enable=true" + - "traefik.http.routers.kibana.rule=Host(`kibana.localhost`)" + - "traefik.http.routers.kibana.entrypoints=web" + - "traefik.http.routers.kibana.service=kibana" + - "traefik.http.services.kibana.loadbalancer.server.port=5601" + + postgres: + container_name: postgres + image: postgres:12 + ports: + - "5432:5432" + environment: + - POSTGRES_PASSWORD=adminpg + - TZ=Europe/Brussels + - PUID=1000 + - PGID=1000 + volumes: + - postgres:/var/lib/postgresql/data + - ../configs/samples:/opt/samples + + mariadb: + image: linuxserver/mariadb + container_name: mariadb + ports: + - "3306:3306" + environment: + - PUID=1000 + - PGID=1000 + - MYSQL_ROOT_PASSWORD=mariadb + - TZ=Europe/Brussels + volumes: + - mariadb:/config + + tika: + image: apache/tika + container_name: tika + ports: + - "9998:9998" + labels: + - "traefik.enable=true" + - "traefik.http.routers.tika.rule=Host(`tika.localhost`)" + - "traefik.http.routers.tika.entrypoints=web" + + minio: + image: minio/minio + container_name: minio + volumes: + - s3:/data + ports: + - 9000:9000 + environment: + MINIO_ACCESS_KEY: accesskey + MINIO_SECRET_KEY: secretkey + command: server /data --console-address ":9001" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + labels: + - "traefik.enable=true" + - "traefik.http.routers.minio.rule=Host(`minio.localhost`)" + - "traefik.http.routers.minio.service=minio" + - "traefik.http.routers.minio.entrypoints=web" + - "traefik.http.services.minio.loadbalancer.server.port=9001" + + redis: + image: centos/redis-5-centos7 + container_name: redis + ports: + - 6379:6379 + volumes: + - redis:/var/lib/redis/data + + redis-commander: + image: rediscommander/redis-commander:latest + environment: + - REDIS_HOSTS=local:redis:6379 + labels: + - "traefik.enable=true" + - "traefik.http.routers.redis-commander.rule=Host(`redis-commander.localhost`)" + - "traefik.http.routers.redis-commander.service=redis-commander" + - "traefik.http.routers.redis-commander.entrypoints=web" + - "traefik.http.services.redis-commander.loadbalancer.server.port=8081" + + mailhog: + image: mailhog/mailhog + container_name: mailhog_ems + ports: + - 1025:1025 # smtp server + #- 8025:8025 # web ui + labels: + - "traefik.enable=true" + - "traefik.http.routers.mailhog.rule=Host(`mailhog.localhost`)" + - "traefik.http.routers.mailhog.service=mailhog" + - "traefik.http.routers.mailhog.entrypoints=web" + - "traefik.http.routers.mailhog-tls.rule=Host(`mailhog.localhost`)" + - "traefik.http.routers.mailhog-tls.service=mailhog" + - "traefik.http.routers.mailhog-tls.entrypoints=websecure" + - "traefik.http.routers.mailhog-tls.tls=true" + - "traefik.http.services.mailhog.loadbalancer.server.port=8025" +volumes: + data01: + driver: local + data02: + driver: local + data03: + driver: local + redis: + driver: local + s3: + driver: local + mariadb: + driver: local + postgres: + driver: local diff --git a/docker/pg_drop.sh b/docker/pg_drop.sh new file mode 100644 index 000000000..9472cd8ea --- /dev/null +++ b/docker/pg_drop.sh @@ -0,0 +1,6 @@ +#/bin/bash + +#sh pg_drop.sh + +docker-compose exec -e PGUSER=postgres -e PGPASSWORD=adminpg -T postgres psql -c "DROP DATABASE IF EXISTS $1;" +docker-compose exec -e PGUSER=postgres -e PGPASSWORD=adminpg -T postgres psql -c "DROP USER IF EXISTS $1;" diff --git a/docker/pg_init.sh b/docker/pg_init.sh new file mode 100644 index 000000000..f94c2c2bb --- /dev/null +++ b/docker/pg_init.sh @@ -0,0 +1,11 @@ +#/bin/bash + +#sh pg_init.sh my_database schema_my_database_adm + +docker compose exec -e PGUSER=postgres -e PGPASSWORD=adminpg -T postgres psql -c "CREATE USER $1 WITH ENCRYPTED PASSWORD '$1';" +docker compose exec -e PGUSER=postgres -e PGPASSWORD=adminpg -T postgres psql -c "CREATE DATABASE $1 WITH OWNER $1;" +docker compose exec -e PGUSER=postgres -e PGPASSWORD=adminpg -T postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $1 TO $1;" +docker compose exec -e PGUSER=postgres -e PGPASSWORD=adminpg -T postgres psql -d $1 -c "ALTER SCHEMA public OWNER TO $1;" +docker compose exec -e PGUSER=postgres -e PGPASSWORD=adminpg -T postgres psql -d $1 -c "ALTER SCHEMA public RENAME TO $2" +docker compose exec -e PGUSER=postgres -e PGPASSWORD=adminpg -T postgres psql -d $1 -c "ALTER USER $1 SET search_path TO $2;" +docker compose exec -e PGUSER=postgres -e PGPASSWORD=adminpg -T postgres psql -d $1 -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA $2 TO $1;" diff --git a/elasticms-admin/.env.dist b/elasticms-admin/.env.dist index 1738d9e87..74dd41df2 100644 --- a/elasticms-admin/.env.dist +++ b/elasticms-admin/.env.dist @@ -10,7 +10,7 @@ APP_SECRET=7b19a4a6e37b9303e4f6bca1dc6691ed ###< symfony/framework-bundle ### ###> symfony/mailer ### -MAILER_URL=null://null +MAILER_URL=smtp://localhost:1025 ###< symfony/mailer ### ###> doctrine/doctrine-bundle ### @@ -19,11 +19,11 @@ MAILER_URL=null://null # Configure your db driver and server_version in config/packages/doctrine.yaml # elasticms supports currently 3 RDBMS: pgsql, mysql and sqlite # Pgsql default port 5432, mysql default port 3306s -DB_DRIVER='sqlite' -DB_USER='user' -DB_PASSWORD='user' -DB_PORT='1234' -DB_NAME='app.db' +DB_DRIVER='pgsql' +DB_USER='demo' +DB_PASSWORD='demo' +DB_PORT='5432' +DB_NAME='demo' ###< doctrine/doctrine-bundle ### ###> Redis ### @@ -33,7 +33,7 @@ REDIS_PORT=6379 ###> EMSCommonBundle ### EMS_ELASTICSEARCH_HOSTS='["http://localhost:9200"]' -EMS_STORAGES='[{"type":"fs","path":"./var/assets"}]' +EMS_STORAGES='[{"type":"s3","usage":"cache","upload-folder":"/tmp/ems-uploads","bucket":"demo","credentials":{"version":"2006-03-01","credentials":{"key":"accesskey","secret":"secretkey"},"region":"us-east-1","endpoint":"http://localhost:9099","use_path_style_endpoint":true}}]' EMS_CACHE=file_system EMS_CACHE_PREFIX='' EMS_METRIC_ENABLED=false @@ -53,8 +53,8 @@ EMSCH_LOCALES='["en","fr","nl"]' ###< EMSCommonBundle ### ###> EMSCoreBundle ### -EMSCO_TIKA_DOWNLOAD_URL='https://repo1.maven.org/maven2/org/apache/tika/tika-app/1.21/tika-app-1.21.jar' -EMSCO_TIKA_SERVER='' +EMSCO_TIKA_DOWNLOAD_URL='https://dlcdn.apache.org/tika/2.6.0/tika-app-2.6.0.jar' +EMSCO_TIKA_SERVER='http://localhost:9998' EMSCO_PRIVATE_KEY= EMSCO_PUBLIC_KEY= EMSCO_INSTANCE_ID=elasticms_ @@ -73,8 +73,6 @@ EMSCO_FROM_EMAIL_NAME='elasticms' #EMSCO_ASSET_CONFIG_INDEX='' #EMSCO_UPLOAD_FOLDER='' #EMS_CIRCLES_OBJECT='' -EMS_ASSET_CONFIG='{"preview":{"_config_type":"image","_width":300,"_height":200,"_resize":"fill","_radius":0,"_radius_geometry":["topleft","bottomright"]}}' -#EMSCO_TRIGGER_JOB_FROM_WEB=true #EMSCO_PRE_GENERATED_OUUIDS=false #EMSCO_URL_USER='' ###< EMSCoreBundle ### @@ -85,4 +83,4 @@ EMS_ASSET_CONFIG='{"preview":{"_config_type":"image","_width":300,"_height":200, #EMSF_LOAD_FROMJSON='false' #EMSF_CACHEABLE='true' #EMSF_TYPE=form_instance -###< elasticms/form-bundle ### \ No newline at end of file +###< elasticms/form-bundle ### diff --git a/elasticms-admin/config/packages/doctrine_migrations.yaml b/elasticms-admin/config/packages/doctrine_migrations.yaml index ba43bf567..4f635f84f 100644 --- a/elasticms-admin/config/packages/doctrine_migrations.yaml +++ b/elasticms-admin/config/packages/doctrine_migrations.yaml @@ -7,3 +7,8 @@ doctrine_migrations: version_column_name: 'version' version_column_length: 191 executed_at_column_name: 'executed_at' + +when@dev: + doctrine_migrations: + migrations_paths: + Application\Migrations: '%kernel.project_dir%/../EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_%env(resolve:DB_DRIVER)%'