From e000120263f88547204f8e29113efa6342b7be15 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Fri, 12 Aug 2016 18:38:18 +1000 Subject: [PATCH 1/2] Added Dockerfile and docker profile. --- Dockerfile | 20 ++ .../ansible/config/profiles/docker.config.yml | 246 ++++++++++++++++++ .../ansible/roles/beetbox-init/tasks/main.yml | 2 + 3 files changed, 268 insertions(+) create mode 100644 Dockerfile create mode 100644 provisioning/ansible/config/profiles/docker.config.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1ce6569 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:14.04 + +WORKDIR /beetbox + +ENV BEET_PROFILE 'docker' + +EXPOSE 80 + +VOLUME ["/var/beetbox"] + +# Install sudo. +RUN apt-get update && \ + apt-get install -y sudo && \ + apt-get clean + +# Copy source files into the build context. +COPY . /beetbox + +# Provision Beetbox. +RUN /beetbox/provisioning/beetbox.sh \ No newline at end of file diff --git a/provisioning/ansible/config/profiles/docker.config.yml b/provisioning/ansible/config/profiles/docker.config.yml new file mode 100644 index 0000000..25c8d1e --- /dev/null +++ b/provisioning/ansible/config/profiles/docker.config.yml @@ -0,0 +1,246 @@ +--- +# +# Beetbox VM configuration. +# +# Settings below related to the Ansible roles from Galaxy. +# Copy any of these settings to the custom config file to override. +# + +# Beetbox config. +beet_repo: "{{ lookup('env','BEET_REPO') | default('https://github.com/beetboxvm/beetbox.git',true) }}" +beet_version: "{{ lookup('env','BEET_VERSION') | default('master',true) }}" +beet_home: "{{ lookup('env','BEET_HOME') | default('/beetbox',true) }}" +beet_role_dir: "{{ beet_home }}/provisioning/ansible/roles" +beet_project: drupal +beet_debug: no +beet_domain: "{{ ansible_hostname }}.local" +beet_aliases: [] +beet_user: "{{ lookup('env','BEET_USER') | default('vagrant',true) }}" +beet_base: "{{ lookup('env','BEET_BASE') | default('/var/beetbox',true) }}" +beet_root: "{{ beet_base }}" +beet_web: "{{ beet_root }}" +beet_ssh_home: "{{ beet_root }}" +beet_site_name: "Beetbox" +beet_webserver: apache +beet_mysql_user: beetbox +beet_mysql_password: beetbox +beet_mysql_database: "beetbox" +beet_custom_pre_tasks: "{{ beet_base }}/.beetbox/tasks/pre/*" +beet_custom_post_tasks: "{{ beet_base }}/.beetbox/tasks/post/*" + +# Symlinks. +symlinks: no + +# Known hosts. +known_hosts: no + +# Apache config. +apache_daemon: apache2 +apache_remove_default_vhost: true +apache_listen_port: "{{ (beet_webserver == 'apache') | ternary('80','82') }}" +apache_vhosts: + - servername: "{{ beet_domain }}" + documentroot: "{{ beet_web }}" + extra_parameters: | + ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000{{ beet_web }}" +apache_listen_port_ssl: "{{ (beet_webserver == 'apache') | ternary('443','444') }}" +apache_vhosts_ssl: + - servername: "{{ beet_domain }}" + documentroot: "{{ beet_web }}" + certificate_file: "/etc/ssl/certs/ssl-cert-snakeoil.pem" + certificate_key_file: "/etc/ssl/private/ssl-cert-snakeoil.key" + extra_parameters: | + ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000{{ beet_web }}" +apache_mods_enabled: + - authn_core.load + - expires.load + - ssl.load + - rewrite.load + - proxy.load + - proxy_fcgi.load + +# Databases. +mysql_databases: [] +mysql_users: [] + +# Extra utilities form provided roles. +# Enabled by default. +installed_extras_init: yes +installed_extras_apache: yes +installed_extras_avahi: yes +installed_extras_composer: yes +installed_extras_drush: yes +installed_extras_git: yes +installed_extras_mailhog: yes +installed_extras_nginx: yes +installed_extras_php: yes +installed_extras_upload_progress: yes +installed_extras_web: yes + +# Disabled by default. +installed_extras_adminer: no +installed_extras_apparmor: no +installed_extras_blackfire: no +installed_extras_dcr: no +installed_extras_docker: no +installed_extras_drupal_console: no +installed_extras_elasticsearch: no +installed_extras_firewall: no +installed_extras_lxd: no +installed_extras_pecl: no +installed_extras_memcached: no +installed_extras_mysql: no +installed_extras_newrelic: no +installed_extras_nodejs: no +installed_extras_pantheon_cli: no +installed_extras_phantomjs: no +installed_extras_pimpmylog: no +installed_extras_postfix: no +installed_extras_postgresql: no +installed_extras_redis: no +installed_extras_ruby: no +installed_extras_rvm: no +installed_extras_selenium: no +installed_extras_solr: no +installed_extras_varnish: no +installed_extras_wp_cli: no +installed_extras_xdebug: no +installed_extras_xhprof: no + +# Extra packages. +extra_packages: + - imagemagick + - php5-sqlite + - unzip + +# git config. +git_packages: + - git + +# Varnish config. +varnish_listen_port: 81 +varnish_storage: "malloc,256m" + +# Nodejs config. +nodejs_version: "0.12" +nodejs_npm_global_packages: [] +nodejs_install_npm_user: "{{ beet_user }}" +npm_config_prefix: "home/{{ beet_user }}/.npm-global" + +# Ruby config. +ruby_install_gems_user: "vagrant" +ruby_install_gems: [] + +# Nginx config. +nginx_listen_port: "{{ (beet_webserver == 'nginx') | ternary('80','82') }}" +nginx_php_fpm: /var/run/php5-fpm.sock +nginx_remove_default_vhost: true +nginx_hosts: + - listen: "{{ nginx_listen_port }}" + server_name: "{{ beet_domain }}" + root: "{{ beet_web }}" + is_php: true + +# Docker config. +docker_group_members: + - "{{ beet_user }}" + +# PHP config. +php_version: "5.6" +php_memory_limit: "192M" +php_date_timezone: "Australia/Melbourne" +php_display_errors: "On" +php_display_startup_errors: "On" +php_realpath_cache_size: "1024K" +php_sendmail_path: "/opt/mailhog/mhsendmail" +php_enable_apc: no +php_opcache_enabled_in_ini: true +php_opcache_memory_consumption: "192" +php_opcache_max_accelerated_files: 4096 +php_opcache_conf_filename: "10-opcache.ini" +php_max_input_vars: "4000" +php_conf_paths: + - "/etc/php/{{ php_version }}/fpm" + - "/etc/php/{{ php_version }}/apache2" + - "/etc/php/{{ php_version }}/cli" +php_extension_conf_paths: + - "/etc/php/{{ php_version }}/fpm/conf.d" + - "/etc/php/{{ php_version }}/apache2/conf.d" + - "/etc/php/{{ php_version }}/cli/conf.d" +php_enable_php_fpm: true +php_fpm_listen: "127.0.0.1:9000" +php_fpm_daemon: "php{{ php_version }}-fpm" +php_fpm_conf_path: "/etc/php/{{ php_version }}/fpm" +php_fpm_pool_conf_path: "{{ php_fpm_conf_path }}/pool.d/www.conf" +php_mysql_package: "php{{ php_version }}-mysql" +php_memcached_package: "php-memcache" +php55_packages: + - php5.5 + - php5.5-curl + - php5.5-dev + - php5.5-fpm + - php5.5-gd + - php5.5-intl + - php5.5-mbstring + - php5.5-xml + - libapache2-mod-php5.5 +php56_packages: + - php5.6 + - php5.6-cli + - php5.6-common + - php5.6-curl + - php5.6-dev + - php5.6-fpm + - php5.6-gd + - php5.6-intl + - php5.6-json + - php5.6-mbstring + - php5.6-mysql + - php5.6-opcache + - php5.6-readline + - php5.6-xml + - libapache2-mod-php5.6 +php70_packages: + - php7.0 + - php7.0-curl + - php7.0-dev + - php7.0-fpm + - php7.0-gd + - php7.0-mbstring + - php7.0-sqlite3 + - php7.0-xml + - libapache2-mod-php7.0 + +# Composer config. +composer_path: /usr/bin/composer +composer_home_path: '/home/{{ beet_user }}/.composer' +composer_home_owner: "{{ beet_user }}" +composer_home_group: "{{ beet_user }}" +composer_global_packages: + - { name: hirak/prestissimo, release: '^0.3' } + +# Drush config. +drush_version: "8.1.2" +drush_keep_updated: "{{ (drush_version != '8.1.2') }}" +drush_composer_cli_options: "--prefer-dist --no-interaction" +drush_create_alias: yes +drush_alias_name: "{{ beet_domain }}" + +# Solr config. +solr_version: "4.10.4" +solr_xms: "64M" +solr_xmx: "128M" + +# Selenium config. +selenium_version: 2.46.0 + +# Mailhog. +mailhog_daemonize_bin_path: /usr/sbin/daemonize + +# DCR config. +dcr_install_dir: "{{ beet_root }}" + +# Other config. +known_hosts_path: ~/.ssh/known_hosts +workspace: "{{ beet_home }}/workspace/{{ php_version }}" +welcome_template: "templates/welcome.txt.j2" \ No newline at end of file diff --git a/provisioning/ansible/roles/beetbox-init/tasks/main.yml b/provisioning/ansible/roles/beetbox-init/tasks/main.yml index 6727e7f..e90fdb3 100644 --- a/provisioning/ansible/roles/beetbox-init/tasks/main.yml +++ b/provisioning/ansible/roles/beetbox-init/tasks/main.yml @@ -2,6 +2,7 @@ - name: Set hostname. hostname: name: "{{ beet_domain }}" + when: ansible_virtualization_type != 'docker' - name: Add domains and aliases to hosts file. lineinfile: @@ -11,6 +12,7 @@ owner: root group: root mode: 0644 + failed_when: false - name: Update apt cache if needed. apt: update_cache=yes cache_valid_time=86400 From 78a6df2d002c6b1945f33e1296fa813cac6fc0ce Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Mon, 15 Aug 2016 12:32:21 +1000 Subject: [PATCH 2/2] #309: Fixed missing newlines. --- Dockerfile | 2 +- provisioning/ansible/config/profiles/docker.config.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1ce6569..9ba4d76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,4 +17,4 @@ RUN apt-get update && \ COPY . /beetbox # Provision Beetbox. -RUN /beetbox/provisioning/beetbox.sh \ No newline at end of file +RUN /beetbox/provisioning/beetbox.sh diff --git a/provisioning/ansible/config/profiles/docker.config.yml b/provisioning/ansible/config/profiles/docker.config.yml index 25c8d1e..d262d8c 100644 --- a/provisioning/ansible/config/profiles/docker.config.yml +++ b/provisioning/ansible/config/profiles/docker.config.yml @@ -243,4 +243,4 @@ dcr_install_dir: "{{ beet_root }}" # Other config. known_hosts_path: ~/.ssh/known_hosts workspace: "{{ beet_home }}/workspace/{{ php_version }}" -welcome_template: "templates/welcome.txt.j2" \ No newline at end of file +welcome_template: "templates/welcome.txt.j2"