Skip to content

Commit cb2141a

Browse files
authored
Updated install.sh scrip to get the latest version per branch. Fixed some localgov templates (#189)
* 2.x: Fixed some bits about localgov * 2.x: Getting the latest release available per branch
1 parent a24ec88 commit cb2141a

File tree

5 files changed

+92
-70
lines changed

5 files changed

+92
-70
lines changed

install.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ fi
4343

4444
# Version is optional.
4545
if [ -z "$VERSION" ]; then
46-
VERSION=$( curl --silent "https://api.github.com/repos/codeenigma/ce-dev/releases/latest" | grep tag_name | cut -d \" -f 4)
46+
API_URL="https://api.github.com/repos/codeenigma/ce-dev/releases"
47+
VERSION=$(curl -s $API_URL | grep -Eo '"tag_name":\s*"2\.[^"]*"' | grep -Eo '2\.[^"]*' | sort -Vr | head -n 1)
48+
49+
# Check if we found a release
50+
if [ -n "$VERSION" ]; then
51+
echo "Downloading the latest 2.x version: $VERSION"
52+
else
53+
echo "No 2.x release found"
54+
fi
4755
fi
4856

4957
RELEASE=https://github.com/codeenigma/ce-dev/releases/download/$VERSION/ce-dev-v$VERSION-$PLATFORM-x64.tar.gz

templates/drupal10/ce-dev/ansible/deploy.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# You can safely remove these steps once you have a working composer.json.
4343
- name: Download composer file.
4444
ansible.builtin.get_url:
45-
url: https://raw.githubusercontent.com/drupal/recommended-project/10.1.x/composer.json
45+
url: https://raw.githubusercontent.com/drupal/recommended-project/10.3.x/composer.json
4646
dest: "{{ deploy_path }}/composer.json"
4747
force: false
4848
- name: Install drush.

templates/localgov/ce-dev/ansible/deploy.yml.j2

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,47 @@
22
# Template playbook for a local Drupal9 codebase.
33
- hosts: {{ project_name }}-web
44
vars:
5-
- project_name: {{ project_name }}
6-
- project_type: drupal8
7-
- webroot: web
8-
- build_type: local
9-
- _env_type: dev
5+
project_name: {{ project_name }}
6+
project_type: drupal8
7+
webroot: web
8+
build_type: local
9+
_env_type: dev
1010
{% raw %}
11-
- _domain_name: www.{{ project_name }}.local
11+
_domain_name: www.{{ project_name }}.local
1212
# Path to your project root. This must match the "volume" set in the docker compose template.
13-
- deploy_path: /home/ce-dev/deploy/live.local
13+
deploy_path: /home/ce-dev/deploy/live.local
1414
# This actually does not take any backup, but is needed to populate settings.php.
15-
- mysql_backup:
16-
handling: none
17-
credentials_handling: static
15+
mysql_backup:
16+
handling: none
17+
credentials_handling: static
1818
# A list of Drupal sites (for multisites).
19-
- drupal:
20-
sites:
21-
- folder: "default"
22-
public_files: "sites/default/files"
23-
install_command: "-y si localgov"
24-
# Toggle config import on/off. Disabled for initial passes.
25-
config_import_command: ""
26-
# config_import_command: "cim"
27-
config_sync_directory: "config/sync"
28-
sanitize_command: "sql-sanitize"
29-
# Remove after initial pass, to avoid reinstalling Drupal.
30-
force_install: true
31-
base_url: "https://{{ _domain_name }}"
19+
drupal:
20+
sites:
21+
- folder: "default"
22+
public_files: "sites/default/files"
23+
install_command: "-y si localgov"
24+
# Toggle config import on/off. Disabled for initial passes.
25+
config_import_command: ""
26+
# config_import_command: "cim"
27+
config_sync_directory: "config/sync"
28+
sanitize_command: "sql-sanitize"
29+
# Remove after initial pass, to avoid reinstalling Drupal.
30+
force_install: true
31+
base_url: "https://{{ _domain_name }}"
3232
# Composer command to run.
33-
- composer:
34-
command: install
35-
no_dev: false
36-
working_dir: "{{ deploy_path }}"
37-
apcu_autoloader: false
33+
composer:
34+
command: install
35+
no_dev: false
36+
working_dir: "{{ deploy_path }}"
37+
apcu_autoloader: false
38+
drush:
39+
use_vendor: true
40+
drush_bin: "{{ deploy_path }}/vendor/drush/drush/drush"
3841
pre_tasks:
3942
# You can safely remove these steps once you have a working composer.json.
4043
- name: Download composer file.
4144
ansible.builtin.get_url:
42-
url: https://raw.githubusercontent.com/drupal/recommended-project/9.1.x/composer.json
45+
url: https://raw.githubusercontent.com/drupal/recommended-project/10.3.x/composer.json
4346
dest: "{{ deploy_path }}/composer.json"
4447
force: false
4548
- name: Adding composer/installers plugin to composer config.
@@ -70,13 +73,20 @@
7073
- name: Install drush.
7174
community.general.composer:
7275
command: require
73-
arguments: drush/drush:10.*
76+
arguments: drush/drush:12.*
7477
working_dir: "{{ deploy_path }}"
7578
- name: Install localgov.
7679
community.general.composer:
7780
command: require
7881
arguments: localgovdrupal/localgov
7982
working_dir: "{{ deploy_path }}"
83+
post_tasks:
84+
- name: "Symlink global Drush"
85+
ansible.builtin.file:
86+
src: "{{ drush_bin }}"
87+
dest: "/usr/local/bin/drush"
88+
state: link
89+
become: yes
8090
roles:
8191
- _init # Sets some variables the deploy scripts rely on.
8292
- composer # Composer install step.

templates/localgov/ce-dev/ansible/provision.yml.j2

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,49 @@
1919
ce_provision:
2020
local_dir: /home/ce-dev/ce-provision
2121
{% raw %}
22-
- nginx:
23-
domains:
24-
- server_name: "{{ _domain_name }}"
25-
access_log: "/var/log/nginx-access.log"
26-
error_log: "/var/log/nginx-error.log"
27-
error_log_level: "notice"
28-
webroot: "/home/ce-dev/deploy/live.local/web"
29-
project_type: "drupal8"
30-
ssl:
31-
domain: "{{ _domain_name }}"
32-
cert: "{{ _ce_dev_mkcert_base}}/{{ _domain_name }}.pem"
33-
key: "{{ _ce_dev_mkcert_base}}/{{ _domain_name }}-key.pem"
34-
handling: "unmanaged"
35-
ratelimitingcrawlers: false
36-
is_default: true
37-
servers:
38-
- port: 80
39-
ssl: false
40-
https_redirect: true
41-
- port: 443
42-
ssl: true
43-
https_redirect: false
44-
upstreams: []
45-
- php:
46-
version:
47-
- 8.1
48-
cli:
49-
memory_limit: -1
50-
_env_type: dev
51-
fpm:
52-
_env_type: dev
53-
- xdebug:
54-
cli: true
55-
- nodejs:
56-
version: 20.x
57-
- apt_unattended_upgrades:
58-
enable: false
22+
nginx:
23+
domains:
24+
- server_name: "{{ _domain_name }}"
25+
access_log: "/var/log/nginx-access.log"
26+
error_log: "/var/log/nginx-error.log"
27+
error_log_level: "notice"
28+
webroot: "/home/ce-dev/deploy/live.local/web"
29+
project_type: "drupal8"
30+
ssl:
31+
domain: "{{ _domain_name }}"
32+
cert: "{{ _ce_dev_mkcert_base}}/{{ _domain_name }}.pem"
33+
key: "{{ _ce_dev_mkcert_base}}/{{ _domain_name }}-key.pem"
34+
handling: "unmanaged"
35+
ratelimitingcrawlers: false
36+
is_default: true
37+
servers:
38+
- port: 80
39+
ssl: false
40+
https_redirect: true
41+
- port: 443
42+
ssl: true
43+
https_redirect: false
44+
upstreams: []
45+
php:
46+
version:
47+
- 8.1
48+
cli:
49+
memory_limit: -1
50+
_env_type: dev
51+
fpm:
52+
_env_type: dev
53+
xdebug:
54+
cli: true
55+
nodejs:
56+
version: 20.x
57+
apt_unattended_upgrades:
58+
enable: false
5959
{% endraw %}
6060
tasks:
6161
- apt:
6262
update_cache: true
63+
- import_role:
64+
name: _init
6365
- import_role:
6466
name: _meta/common_base
6567
- import_role:
@@ -70,3 +72,5 @@
7072
name: debian/php-fpm
7173
- import_role:
7274
name: debian/nginx
75+
- import_role:
76+
name: _exit

templates/localgov/ce-dev/ansible/web/sites/default/local.settings.php.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require __DIR__ . '/default.settings.php';
77
/**
88
* Include local dev settings.
99
*/
10-
require DRUPAL_ROOT . '/sites/example.settings.local.php'
10+
require DRUPAL_ROOT . '/sites/example.settings.local.php';
1111

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

0 commit comments

Comments
 (0)