Giter Club home page Giter Club logo

docker-drupal7's Introduction

docker-drupal7

Container for running Drupal7 based sites.

Starting container

Create a data volume container

See https://docs.docker.com/engine/userguide/containers/dockervolumes/

	
	# docker create -v /var/www --name drupal-data alpine:latest /bin/true

Including SSL, custom nginx configs

Before building container, you can customize it, including your own nginx config files for your sites into sites/available directory, alongside with certificates into ssl directory.

Build current container


	# docker build -t solfisk/drupal7 .

Now spin up the drupal7 container


	# docker run --volumes-from drupal-data -l mariadb-percona:mysql --name drupal7 solfisk/drupal7

Verify, that container works - it have to show php_info on http://172.22.0.4/ and http://172.22.0.4/robots.txt

This container has this:

  • nginx running on 0.0.0.0:80, 0.0.0.0:443 ports

  • PHP-FPM running on 127.0.0.1:9000 port

  • memcached running on 127.0.0.1:11211 port

  • drupal files saved in /var/www/localhost/htdocs

  • script to backup data

  • script to restore data

  • script to generate nginx site - config + directory for it

Backup data


	# docker exec -ti drupal7 backup > /var/tmp/drupal7.backup

Restore data


	# cat /var/tmp/drupal7.backup | docker exec -ti drupal7 restore 

Create new site


	# docker exec -ti drupal7 createSite drupal7.local

It will create directory of /var/ww/drupal7.local, the corresponding config in /etc/nginx/sites-available/drupal7.local, enable it by means of symlinking it to /etc/nginx/sites-enabled/drupal7.local, than test and reload nginx config.

Download drupal core

Execute this script to download drupal-7 from official repo using drush into newly created directory for drupal7.local


	# docker exec -ti drupal7 drush dl --destination /var/www/drupal7.local drupal-7.x

Set up a site

We can configure drupal using drush tool like this:


 	# docker exec -ti drupal7 cd /var/www/drupal7.local && drush site-install standard \
	--site-name=drupal7.local \
    --account-name=admin \
    --account-pass=admin \
    --db-url=mysql://admin:admin@mysql:3306/my-site

Database docker container

We can run mysql database using this command:

    docker run --name mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d solfisk/mariadb-percona:latest

Than we need to inspect it to get it's IP address on local network being bridged


    # docker inspect mysql

I have it running on IPAddress": "172.17.0.2".

Than we need to create database on this host.


    $ mysql_setpermission --host 172.17.0.2 -user root --password

You need to create user admin with password admin and database of name of nota_dk and grant SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER permissions on it from any host. I used mysql workbench for doing this.

Info

Start and link mysql container in private network

https://docs.docker.com/engine/userguide/networking/work-with-networks/#linking-containers-in-user-defined-networks

Start and link drupal container in private network

docker -t docker-drupal7 build .

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.