Add all files needed to bring up VM and run agaric.com locally

This commit is contained in:
benjamin melançon 2018-08-20 10:45:20 -04:00
parent 52c8b60bac
commit 4d2bc0ee24
742 changed files with 24037 additions and 0 deletions

View file

@ -0,0 +1 @@
DoNotUseThisFileForProduction!

View file

@ -0,0 +1,6 @@
---
- hosts: all
any_errors_fatal: True
roles:
- role: drupal
serial: 1

View file

@ -0,0 +1,4 @@
---
web_dir: "~/site"
db_name: drupal
db_user: drupal

View file

@ -0,0 +1,13 @@
---
config_import: true
db_user: "{{ vault_db_user }}"
db_pwd: "{{ vault_db_pwd }}"
db_name: username_test
server_hostname: username-test.drutopia.org
server_aliases:
- "username.drutopia.org"
ssl_cert_path: ""
ssl_key_path: ""
git_repo: git@gitlab.com:my-org/my-project.git
git_branch: master
web_dir: /home/username_test/site/

View file

@ -0,0 +1,8 @@
$ANSIBLE_VAULT;1.1;AES256
65396435663335626232313336633134313964393733646639666133303030666162646432346363
3330636563626464613233343566393734393932663064310a383936393165373632636434376331
65613562383332656166373230316638363333396438663337613731646566366636643866353738
6161646237616663350a313361373538613230333063306634306434323730313832636163616632
30326566383066653764316531643334613934623631376462376265313139613561353831353037
65343263393338353139666534323934323266383934316234366135386536333936366461363638
353437303436333633633564373762643237

View file

@ -0,0 +1,2 @@
[drupal]
test ansible_host=username-test.drutopia.org ansible_user=username_test

View file

@ -0,0 +1,4 @@
---
build_dir: "../../build"
theme_name: "octavio"
server_aliases: []

View file

@ -0,0 +1,74 @@
---
# If re-enabled, allow to fail when missing:
# - name: reclaim permission to settings.local.php
# file:
# path: "{{ build_dir }}/web/sites/default/settings.local.php"
# state: file
# mode: "0766"
# delegate_to: 127.0.0.1
# run_once: true
#
# - name: reclaim permission to settings folder
# file:
# path: "{{ build_dir }}/web/sites/default"
# state: directory
# mode: "0777"
# recurse: true
# delegate_to: 127.0.0.1
# run_once: true
- name: delete build directory
file:
path: "{{ build_dir }}"
state: absent
delegate_to: 127.0.0.1
run_once: true
- name: re-create build directory
file:
path: "{{ build_dir }}"
state: directory
delegate_to: 127.0.0.1
run_once: true
- name: checkout version {{ git_branch }}
git:
accept_hostkey: yes
clone: yes
depth: 1
dest: "{{ build_dir }}"
name: "{{ git_repo }}"
update: yes
version: "{{ git_branch }}"
delegate_to: 127.0.0.1
run_once: true
- name: set site directory permissions
file:
path: "{{ build_dir }}"
state: directory
mode: "0755"
delegate_to: 127.0.0.1
run_once: true
# - name: generate css
# Need correct theme path? Just use theme_name as shown?:
# command: sassc {{ build_dir }}/web/themes/custom/{{ theme_name }}/sass/styles.scss {{ build_dir }}/web/themes/custom/{{ theme_name }}/css/styles.css
# delegate_to: 127.0.0.1
# run_once: true
- name: create settings.local.php
template:
src: "settings.local.php.j2"
dest: "{{ build_dir }}/web/sites/default/settings.local.php"
mode: "0755"
delegate_to: 127.0.0.1
- name: install composer-managed items
composer:
command: install
no_dev: true
optimize_autoloader: true
working_dir: "{{ build_dir }}"
delegate_to: 127.0.0.1
run_once: true

View file

@ -0,0 +1,22 @@
- set_fact:
dest: "{{ ansible_user }}@{{ ansible_fqdn }}:{{ web_dir }}"
- name: ensure {{ web_dir }} exists
file:
path: "{{ web_dir }}"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "0755"
# - name: sync migrate folder
# local_action: command rsync -rz --delete {{ build_dir }}/migrate/ {{ dest }}/migrate/
- name: sync vendor folder
local_action: command rsync -rz --delete --links {{ build_dir }}/vendor/ {{ dest }}/vendor/
- name: sync config folder
local_action: command rsync -rz --delete {{ build_dir }}/config/ {{ dest }}/config/
- name: sync web folder
local_action: command rsync -rz --delete --exclude sites/default/files {{ build_dir }}/web/ {{ dest }}/web/

View file

@ -0,0 +1,91 @@
---
- name: update database
shell: "../vendor/bin/drush updb -y"
args:
chdir: "{{ web_dir }}/web/"
tags: deploy
- name: config sync import
shell: "../vendor/bin/drush cim -y"
args:
chdir: "{{ web_dir }}/web/"
when: config_import
tags: deploy
- name: cache rebuild
shell: "../vendor/bin/drush cr all"
args:
chdir: "{{ web_dir }}/web/"
tags: deploy
# Internal deploy process (CI):
# Git checkout projectURI to /home/{user}/site/, allowing overwrite of:
# /web/themes/custom/[*.tpl|*.yml]
# /config
# "Build"? (e.g. sassc)
# Write correct settings.local
# (push/rsync from CI -> stage)
# [link to drutopia version]
# updb/cim/cr
#
# -> test - wipe config and import.
# -> stage/prod - compare configurations.
#
# Already configured via _hosting:
# apache.conf
# db (empty?)
# user acct/apache process/etc
# fpm pool
# php.user.ini
# ...email, logging, etc
#
#
# vendor:
# - composer install
# compile css:
# - sassc
#
# default: test
# SETTINGS_TARGET: copy localhost
#
# drupal (local):
# - vendor, settings
# - drush si
# - chmod u+w defaultdir
#
# build:
# - mk build
# - git ark installation
# - composer install -d build_dir --no_dev
# - settings
# - mk sass dir/file
#
# deploy_config:
# - rsync config
#
# deploy_web:
# - rsync web (excl default)
#
# deploy_vendor:
# - rsync vendor
#
# deploy:
# - config+vendor+web
# - drush updb
# - drush cim
# - drush cr
#
#
#
# namespace :test do
# desc "Run Behat tests."
# task :behat => [:vendor] do
# sh "./vendor/bin/behat --tags '~@javascript' --format pretty --out std --format junit --out reports"
# end
#
# desc "Run performance tests."
# task :performance => [:vendor] do
# sh "./vendor/bin/phpunit --bootstrap ./vendor/autoload.php --log-junit reports/performance.xml tests/"
# end
# end
#

View file

@ -0,0 +1,7 @@
---
- include: build.yml
tags: build
- include: deploy.yml
tags: deploy
- include: drupal.yml
tags: deploy

View file

@ -0,0 +1,29 @@
<?php
/**
* @file
* Settings for the production environment.
*/
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => '{{ db_name }}',
'username' => '{{ db_user }}',
'password' => '{{ db_pwd }}',
'host' => '{{ db_host | default("localhost") }}',
'prefix' => '',
);
$settings['trusted_host_patterns'] = array(
'^{{ server_hostname | regex_replace('(\.)', '\\\.') }}$'
{% for host in server_aliases %}
,'^{{ host | regex_replace('\.', '\\\.') }}$'
{% endfor %}
);
{% if 'dev' in group_names %}
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;
{% endif %}
$config_directories[CONFIG_SYNC_DIRECTORY] = '{{ config_dir | default("../config/sync/") }}';