Skip to content
Snippets Groups Projects
Commit 4b52224a authored by jurgenhaas's avatar jurgenhaas
Browse files

docker/l3d#133 Add support for unlighthouse

parent 1ee09c30
No related branches found
No related tags found
1 merge request!77Merging develop into main
Pipeline #1006689 passed
......@@ -24,3 +24,7 @@ commands:
imports:
- ahoy.cypress.yml
usage: Cypress
unlighthouse:
imports:
- ahoy.unlighthouse.yml
usage: Unlighthouse
ahoyapi: v2
commands:
on:
cmd: |
UNLIGHTHOUSE=1
echo "UNLIGHTHOUSE=1" >>.env
env -i $(cat .env | xargs) >.env
composer lakedrops:docker4drupal --no-interaction
ahoy d4d up unlighthouse
usage: Turn on Unlighthouse
off:
cmd: |
UNLIGHTHOUSE=0
echo "UNLIGHTHOUSE=0" >>.env
env -i $(cat .env | xargs) >.env
composer lakedrops:docker4drupal --no-interaction
ahoy d4d stop unlighthouse
usage: Turn off Unlighthouse
......@@ -201,6 +201,9 @@ class Handler extends BaseHandler {
'enable' => $this->env->receiveGlobal('CYPRESS', 'Cypress', '0'),
'version' => 'latest',
],
'unlighthouse' => [
'enable' => $this->env->receiveGlobal('UNLIGHTHOUSE', 'Unlighthouse', '0'),
],
];
}
......@@ -230,6 +233,7 @@ class Handler extends BaseHandler {
$this->config->setValue('projectroot', $projectRoot, FALSE);
$this->config->setValue('projectdomain', str_replace('_', '-', $this->config->readValue('projectname')) . '.' . $traefik['domain'], FALSE);
$this->config->setValue('projectprotocol', 'http' . ($traefik['usessl'] ? 's' : ''), FALSE);
$this->config->setValue('socketprotocol', 'ws' . ($traefik['usessl'] ? 's' : ''), FALSE);
$projectport = '';
if ($traefik['usessl'] && (int) $traefik['ports'] !== 443) {
$projectport = ':' . $traefik['ports'];
......@@ -344,6 +348,7 @@ class Handler extends BaseHandler {
'projectdomain' => str_replace('_', '-', $this->config->readValue('domain') ?? ''),
'projectprotocol' => 'https',
'projectport' => '',
'socketprotocol' => 'wss',
'extradomains' => $this->config->readValue('aliases') ?? [],
];
foreach ($overwriteConfig as $key => $value) {
......@@ -489,6 +494,9 @@ class Handler extends BaseHandler {
$this->gitIgnore('tests/cypress/screenshots');
$this->gitIgnore('tests/cypress/videos');
// Ignore some Unlighthouse directories
$this->gitIgnore('tests/unlighthouse');
if (getenv('LAKEDROPS_BUILD_NG') !== 'yes') {
$this->updateTraefik();
}
......@@ -626,6 +634,11 @@ class Handler extends BaseHandler {
'dest' => $projectRoot . '/tests/cypress/support',
'add2git' => TRUE,
];
$files['unlighthouse.config.ts'] = [
'source' => 'tests/',
'dest' => $projectRoot . '/tests',
'add2git' => FALSE,
];
if (getenv('LAKEDROPS_BUILD_NG') === 'yes') {
if ($this->config->readValue(['backup', 'enable'])) {
$files['config.yaml'] = [
......
......@@ -570,3 +570,28 @@ services:
user: '1000:{{ docker_group_id }}'
{% endif %}
{% endif %}
{% if unlighthouse.enable|default(0) %}
unlighthouse:
image: 'registry.lakedrops.com/docker/unlighthouse:latest'
restart: unless-stopped
networks:
- traefik-public
- default
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- {{ projectroot }}/tests/unlighthouse/:/data/.unlighthouse
- {{ projectroot }}/tests/unlighthouse.config.ts:/data/unlighthouse.config.ts
working_dir: /data
user: root
labels:
traefik.enable: 'true'
traefik.docker.network: traefik-public
traefik.http.services.{{ projectname }}_unlighthouse.loadbalancer.server.port: 5678
traefik.http.routers.unlighthouse-{{ projectname }}.rule: Host(`{{ projectdomain }}`)
{% if drupal.live|default(0) or traefik.usessl %}
traefik.http.routers.unlighthouse-{{ projectname }}.tls: 'true'
traefik.http.routers.unlighthouse-{{ projectname }}.tls.certresolver: lakedrops
{% endif %}
{% endif %}
export default {
puppeteerOptions: {
args: ["--no-sandbox"],
},
server: {
open: false,
},
site: "{{ projectprotocol }}://{{ projectdomain }}",
serverUrl: "{{ projectprotocol }}:/unlighthouse-{{ projectdomain }}/",
clientUrl: "{{ projectprotocol }}://unlighthouse-{{ projectdomain }}/",
apiUrl: "{{ projectprotocol }}://unlighthouse-{{ projectdomain }}/api",
websocketUrl: "{{ socketprotocol }}://unlighthouse-{{ projectdomain }}/api/ws",
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment