Setup for linux (tested on ubuntu 16.04)
- git (2.7.4 or higher)
- docker (17.05.0-ce or higher)
- docker-compose (1.19.0 or higher)
clone this repository and initialize some local folders
$ git clone [email protected]:Insoumis/timecode.git
$ cd timecode
$ mkdir local
$ mkdir www/sites/default/files
$ sudo chown -R www-data:www-data www/sites/default/files
$ cp docker-compose.dev.yml docker-compose.override.yml
run servers
$ docker-compose up app
download a timecode mysql backup to local/backup.mysql
load database (this may take a while)
$ cat local/backup.mysql | docker exec -i timecode_mysql_1 mysql -u timecode-user --password='timecode-pwd' timecode-db
open your browser at http://localhost:8080
finally stop servers when you're done
$ docker-compose stop
$ docker-compose run --rm drush --help
$ docker-compose run --rm drush status
$ docker-compose run --rm drush pm-list --type=Module --status=enabled
$ docker-compose run --rm drush cache-clear
see https://drushcommands.com/drush-7x/ for more commands.
$ docker exec timecode_mysql_1 mysqldump -u timecode-user --password='timecode-pwd' timecode-db > local/backup.mysql
create a copy of dev.env to prod.env and set safe passwords for environement variables (using tools like http://www.sethcardoza.com/tools/random-password-generator/) :
- DRUPAL_SALT
- MYSQL_PASSWORD
- MYSQL_ROOT_PASSWORD
create the docker compose file for production
$ cp docker-compose.prod.yml docker-compose.override.yml
and replace some values with production settings (exposed port and resources limits)
for SSL enabled environnement (https), it's recommended to force HTTPS by adding following rules in the root .htaccess file :
# Redirect to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
to run containers detached :
$ docker-compose up -d app
to stop all containers :
$ docker-compose stop
to just run the mysql container :
$ docker-compose up -d mysql
to just stop the app container :
$ docker-compose stop app