Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated install.sh scrip to get the latest version per branch. Fixed some localgov templates #189

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ fi

# Version is optional.
if [ -z "$VERSION" ]; then
VERSION=$( curl --silent "https://api.github.com/repos/codeenigma/ce-dev/releases/latest" | grep tag_name | cut -d \" -f 4)
API_URL="https://api.github.com/repos/codeenigma/ce-dev/releases"
VERSION=$(curl -s $API_URL | grep -Eo '"tag_name":\s*"2\.[^"]*"' | grep -Eo '2\.[^"]*' | sort -Vr | head -n 1)

# Check if we found a release
if [ -n "$VERSION" ]; then
echo "Downloading the latest 2.x version: $VERSION"
else
echo "No 2.x release found"
fi
fi

RELEASE=https://github.com/codeenigma/ce-dev/releases/download/$VERSION/ce-dev-v$VERSION-$PLATFORM-x64.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion templates/drupal10/ce-dev/ansible/deploy.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# You can safely remove these steps once you have a working composer.json.
- name: Download composer file.
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/drupal/recommended-project/10.1.x/composer.json
url: https://raw.githubusercontent.com/drupal/recommended-project/10.3.x/composer.json
dest: "{{ deploy_path }}/composer.json"
force: false
- name: Install drush.
Expand Down
70 changes: 40 additions & 30 deletions templates/localgov/ce-dev/ansible/deploy.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,47 @@
# Template playbook for a local Drupal9 codebase.
- hosts: {{ project_name }}-web
vars:
- project_name: {{ project_name }}
- project_type: drupal8
- webroot: web
- build_type: local
- _env_type: dev
project_name: {{ project_name }}
project_type: drupal8
webroot: web
build_type: local
_env_type: dev
{% raw %}
- _domain_name: www.{{ project_name }}.local
_domain_name: www.{{ project_name }}.local
# Path to your project root. This must match the "volume" set in the docker compose template.
- deploy_path: /home/ce-dev/deploy/live.local
deploy_path: /home/ce-dev/deploy/live.local
# This actually does not take any backup, but is needed to populate settings.php.
- mysql_backup:
handling: none
credentials_handling: static
mysql_backup:
handling: none
credentials_handling: static
# A list of Drupal sites (for multisites).
- drupal:
sites:
- folder: "default"
public_files: "sites/default/files"
install_command: "-y si localgov"
# Toggle config import on/off. Disabled for initial passes.
config_import_command: ""
# config_import_command: "cim"
config_sync_directory: "config/sync"
sanitize_command: "sql-sanitize"
# Remove after initial pass, to avoid reinstalling Drupal.
force_install: true
base_url: "https://{{ _domain_name }}"
drupal:
sites:
- folder: "default"
public_files: "sites/default/files"
install_command: "-y si localgov"
# Toggle config import on/off. Disabled for initial passes.
config_import_command: ""
# config_import_command: "cim"
config_sync_directory: "config/sync"
sanitize_command: "sql-sanitize"
# Remove after initial pass, to avoid reinstalling Drupal.
force_install: true
base_url: "https://{{ _domain_name }}"
# Composer command to run.
- composer:
command: install
no_dev: false
working_dir: "{{ deploy_path }}"
apcu_autoloader: false
composer:
command: install
no_dev: false
working_dir: "{{ deploy_path }}"
apcu_autoloader: false
drush:
use_vendor: true
drush_bin: "{{ deploy_path }}/vendor/drush/drush/drush"
pre_tasks:
# You can safely remove these steps once you have a working composer.json.
- name: Download composer file.
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/drupal/recommended-project/9.1.x/composer.json
url: https://raw.githubusercontent.com/drupal/recommended-project/10.3.x/composer.json
dest: "{{ deploy_path }}/composer.json"
force: false
- name: Adding composer/installers plugin to composer config.
Expand Down Expand Up @@ -70,13 +73,20 @@
- name: Install drush.
community.general.composer:
command: require
arguments: drush/drush:10.*
arguments: drush/drush:12.*
working_dir: "{{ deploy_path }}"
- name: Install localgov.
community.general.composer:
command: require
arguments: localgovdrupal/localgov
working_dir: "{{ deploy_path }}"
post_tasks:
- name: "Symlink global Drush"
ansible.builtin.file:
src: "{{ drush_bin }}"
dest: "/usr/local/bin/drush"
state: link
become: yes
roles:
- _init # Sets some variables the deploy scripts rely on.
- composer # Composer install step.
Expand Down
78 changes: 41 additions & 37 deletions templates/localgov/ce-dev/ansible/provision.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,49 @@
ce_provision:
local_dir: /home/ce-dev/ce-provision
{% raw %}
- nginx:
domains:
- server_name: "{{ _domain_name }}"
access_log: "/var/log/nginx-access.log"
error_log: "/var/log/nginx-error.log"
error_log_level: "notice"
webroot: "/home/ce-dev/deploy/live.local/web"
project_type: "drupal8"
ssl:
domain: "{{ _domain_name }}"
cert: "{{ _ce_dev_mkcert_base}}/{{ _domain_name }}.pem"
key: "{{ _ce_dev_mkcert_base}}/{{ _domain_name }}-key.pem"
handling: "unmanaged"
ratelimitingcrawlers: false
is_default: true
servers:
- port: 80
ssl: false
https_redirect: true
- port: 443
ssl: true
https_redirect: false
upstreams: []
- php:
version:
- 8.1
cli:
memory_limit: -1
_env_type: dev
fpm:
_env_type: dev
- xdebug:
cli: true
- nodejs:
version: 20.x
- apt_unattended_upgrades:
enable: false
nginx:
domains:
- server_name: "{{ _domain_name }}"
access_log: "/var/log/nginx-access.log"
error_log: "/var/log/nginx-error.log"
error_log_level: "notice"
webroot: "/home/ce-dev/deploy/live.local/web"
project_type: "drupal8"
ssl:
domain: "{{ _domain_name }}"
cert: "{{ _ce_dev_mkcert_base}}/{{ _domain_name }}.pem"
key: "{{ _ce_dev_mkcert_base}}/{{ _domain_name }}-key.pem"
handling: "unmanaged"
ratelimitingcrawlers: false
is_default: true
servers:
- port: 80
ssl: false
https_redirect: true
- port: 443
ssl: true
https_redirect: false
upstreams: []
php:
version:
- 8.1
cli:
memory_limit: -1
_env_type: dev
fpm:
_env_type: dev
xdebug:
cli: true
nodejs:
version: 20.x
apt_unattended_upgrades:
enable: false
{% endraw %}
tasks:
- apt:
update_cache: true
- import_role:
name: _init
- import_role:
name: _meta/common_base
- import_role:
Expand All @@ -70,3 +72,5 @@
name: debian/php-fpm
- import_role:
name: debian/nginx
- import_role:
name: _exit
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require __DIR__ . '/default.settings.php';
/**
* Include local dev settings.
*/
require DRUPAL_ROOT . '/sites/example.settings.local.php'
require DRUPAL_ROOT . '/sites/example.settings.local.php';

$databases['default']['default'] = array (
'database' => '{{ build_databases[0].name }}',
Expand Down