GithubHelp home page GithubHelp logo

dbjpanda / drupal-on-docker Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 334 KB

A production ready drupal devops project built on top of Docker. Zero down time | Easy roll back

PHP 41.00% Shell 48.74% Dockerfile 10.26%

drupal-on-docker's Introduction

Build Status

Setup Traefik (Ground Work)

Enable Traefik proxy server following below commands to access your services using a "Domain name" instead of "IP:port". This is an one time setup and use with all projects. This is useful for both Drupal and Non-Drupal projects. As this project is configured to work with Traefik by default so we recommend you should set up it first if you have not done it yet. If you don't want to enable Traefik, then you need to manually provide a port number to services and access them using localhost:port.

docker network create -d bridge traefik-network
docker run -d --network=traefik-network -p 80:80 -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock --name=traefik traefik:latest --api --docker

Installation

Step 1

git clone https://github.com/dbjpanda/drupal-on-docker.git && cd drupal-on-docker

Step 2

Rename .env.example to .env and modify the variables like PROJECT_NAME etc as per your requirements

Step 3

docker-compose up -d

Step 4

docker exec -it PROJECT_NAME composer install

Step 5 (Install drupal via drush or through the url 'DOMAIN_NAME' set in .env file)

docker exec -it PROJECT_NAME drush si

Devops workflow ( If you want to deploy to a live server using CI/CD)

Step 1

git clone https://github.com/dbjpanda/drupal-on-docker.git PROJECT_NAME

Step 2

cd PROJECT_NAME 

Step 3

git remote set-url origin https://your_github_project_url

Step 4 ( We have created a branch 8.x-dev for you adding 3 necessary modules like config_suite, config_split, default_content_deploy and its configuration which make this workflow really easy. You can delete the branch and create your own )

git checkout 8.x-dev 

Step 5 ( Change the branch name as per your convenience. Default is 'dev'. If you want to change the branch name other than 'dev' then change it in travis/deploy.sh as well)

git branch -m dev

Step 6 (You must have root permission to execute this script)

./travis/server-setup.sh

Step 7 (Change travis env variables such as DEPLOY_SERVER, secure etc. according to your requirement and encrypt sensitive variables like below)

travis encrypt MYSQL_USER=travis MYSQL_PASSWORD=travistest MYSQL_ROOT_PASSWORD=helloworld ADMIN_PASS=pass DOCKER_USERNAME=dbjpanda DOCKER_PASSWORD=pass

Step 8

Setup Travis for the repo, push your changes and your work is done as an admin or devop engineer. You sucessfully setup the project. Now its time for developers and site builders

Step 9 (Ask your developers to clone the repo, checkout to 'dev', follow the installation process, code or build the site, push changes to remote dev branch. Some useful commands given below)

cp .env.example .env
docker exec -it PROJECT_NAME composer install
IMPORT CONFIG: docker exec -it PROJECT_NAME drush cim --partial
IMPORT DEV CONFIG: docker exec -it PROJECT_NAME drush csim dev_config
IMPORT BLOCK CONTENT: docker exec -it PROJECT_NAME drush dcdi
CODE......................DESIGN................
EXPORT CONFIG: docker exec -it PROJECT_NAME drush csex
EXPORT CONTENT: docker exec -it PROJECT_NAME drush dcdes --skip_entity_type=node,user

Step 10 ( Ask your analytics team to go to the site http://dev.example.com and check if it is ready to push to live server then execute below commands)

git checkout master 
git pull origin dev 
git push origin master

Note: If you faced some issue suddenly after pushing the new changes and you need to roll back to backup then ssh to your server and execute the below command docker start \$(docker ps -a -q --filter name=backup)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.