diff --git a/.env b/.env index b3a3e2c..05906ab 100644 --- a/.env +++ b/.env @@ -3,3 +3,11 @@ MYSQL_USER=contenta MYSQL_PASSWORD=contenta MYSQL_ALLOW_EMPTY_PASSWORD=yes MYSQL_ROOT_PASSWORD=root + +HOSTNAME=contenta.local +HOSTIP=192.168.1.1 + +HOST_MYSQL_PORT=3336 +HOST_PHP_PORT=9009 +HOST_HTTP_PORT=8888 +HOST_HTTPS_PORT=4443 diff --git a/README.md b/README.md index 1fa7b26..3ab313f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,17 @@ # Getting started +The following instructions will build the master 8.x-1.x build of the ContentaCMS and run in your active shell ``` docker-compose build docker-compose up ``` +This set of instructions will build according to a particular branch or tag of the ContentaCMS and run your containers detached (great if you have another application that monitors active containers (i.e.: kitematic) +``` +docker-compose build --build-arg CMS_VERSION=v1.477 +docker-compose up -d +``` + # First-time initialization The container doesn't automatically run `drush site-install` because we want it to be possible to stop and start an existing container without rebuilding the site every time. Instead, you need to manually run this after starting the container the first time: @@ -19,5 +26,27 @@ When it finishes successsfully, the command will output a one-time login URL. Persistent state is stored in two docker volumes (named `data` and `www`). You can destroy and recreate the containers as much as you like and your site will be preserved until you also destroy these volumes. +# .env File + +You'll note that you can manage to change up some of the core values for the default db build configuration as well as where the services will sit and what ports they use externally. + + +``` +MYSQL_DATABASE=contenta +MYSQL_USER=contenta +MYSQL_PASSWORD=contenta +MYSQL_ALLOW_EMPTY_PASSWORD=yes +MYSQL_ROOT_PASSWORD=root + +HOSTNAME=contenta.local +HOSTIP=10.0.0.0 + +HOST_MYSQL_PORT=3306 +HOST_PHP_PORT=9000 +HOST_HTTP_PORT=80 +HOST_HTTPS_PORT=443 +``` +It's really important to manage these values according to where this solution will sit. Both in a secure and insecure environment. +If you have an environment where you've already used up the MySQL port 3306 for a service that is on your local machine, than change this to something else. You can use anything between 1-65535. Although, for the sake of simplicity and convenience, maybe using something like 3336 might be easier to remember. The same thing can be said of any of the other ports used by this project. Assigning new port numbers for your local setup will greatly diminish any conflicts and build and up command issues. diff --git a/docker-compose.yml b/docker-compose.yml index cf9267f..6bd955f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,12 @@ services: nginx: build: ./nginx ports: - - "80:80" - - "443:443" + - "${HOST_HTTP_PORT}:80" + #- "80:80" + - "${HOST_HTTPS_PORT}:443" + #- "443:443" + # extra_hosts: + # - "${HOSTNAME}:${HOSTIP}" networks: - contenta volumes: @@ -16,7 +20,8 @@ services: php: build: ./php ports: - - "9000:9000" + - "${HOST_PHP_PORT}:9000" + #- "9000:9000" volumes: - www:/var/www env_file: @@ -26,12 +31,14 @@ services: database: build: ./database ports: - - "3306:3306" + # HOST:CONTAINER + - "${HOST_MYSQL_PORT}:3306" + #- "3306:3306" volumes: - data:/var/lib/mysql env_file: - .env - networks: + networks: - contenta volumes: @@ -39,4 +46,4 @@ volumes: www: networks: - contenta: + contenta: diff --git a/php/Dockerfile b/php/Dockerfile index a678e39..9a7707d 100644 --- a/php/Dockerfile +++ b/php/Dockerfile @@ -68,8 +68,9 @@ RUN mkdir -p /var/www && \ chmod +x /usr/local/bin/docker-entrypoint && \ chmod +x /usr/local/bin/init-drupal +ARG CMS_VERSION=8.x-1.x RUN cd /usr/local/src && \ - git clone https://github.com/contentacms/contenta_jsonapi && \ + git clone https://github.com/contentacms/contenta_jsonapi --branch ${CMS_VERSION} && \ cd /usr/local/src/contenta_jsonapi && \ composer create-project contentacms/contenta-jsonapi-project /var/www --stability dev --no-interaction && \ cd /var/www && \ diff --git a/php/docker-entrypoint b/php/docker-entrypoint index 76d58c8..781b7f4 100644 --- a/php/docker-entrypoint +++ b/php/docker-entrypoint @@ -4,4 +4,6 @@ ep /etc/php.ini ep /etc/php-fpm.conf ep /etc/php-fpm.d/* +[ ! -e /run/php-fpm ] && mkdir -p /run/php-fpm + exec "$@"