Skip to content

Commit

Permalink
Merge pull request #99 from systemseed/falcon-frontend
Browse files Browse the repository at this point in the history
Reorganise systemseed/falcon into a monorepo with backend and frontend packages
  • Loading branch information
PavelBulat committed Aug 19, 2019
2 parents 2b4ad97 + 5bb8cd1 commit 997033b
Show file tree
Hide file tree
Showing 575 changed files with 17,622 additions and 964 deletions.
72 changes: 55 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,103 @@
version: 2
version: 2.1

jobs:
build_and_test:

machine:
enabled: true
image: circleci/classic:201808-01
image: circleci/classic:latest

steps:
- checkout

- run:
name: Pull Docker images
command: make pull

- run:
name: Fix CircleCI files permissons
command: |
sudo chown ubuntu:ubuntu -R *
sudo chown ubuntu:ubuntu -R .[!.]*
- run:
name: Pull Docker images
command: make pull
name: Install Javascript dependencies
command: make yarn

- run:
name: Check PHP & Javascript code for compliance with Drupal Coding Standards.
name: Check PHP & Javascript code for compliance with Coding Standards.
command: make code:check
when: always

- run:
name: Make local environment
name: Install Falcon on local development environment
command: make install
no_output_timeout: 20m

- run:
name: Add Falcon domain host into /etc/hosts
command: echo 127.0.0.1 falcon.docker.localhost | sudo tee -a /etc/hosts
command: echo 127.0.0.1 falcon.docker.localhost app.docker.localhost | sudo tee -a /etc/hosts

- run:
name: Prepare tests
name: Install test dependencies
command: make tests:prepare

- run:
name: Run basic group tests
command: make tests:run -- -g basic
name: Run codeception basic group tests
command: make tests:codeception -- -g basic

- run:
name: Install additional modules
command: make drush en \$\(ADDITIONAL_MODULES\)

- run:
name: Run basic and additional groups tests
command: make tests:run -- -g basic -g additional
name: Run codeception basic and additional groups tests
command: make tests:codeception -- -g basic -g additional

- run:
name: Run TestCafe tests
command: make tests:testcafe

# Run demo content tests need after end of Acceptance tests,
# because demo-content will be deleted.
- run:
name: Run tests for demo content
command: make tests:run -- -g demo-content
name: Run codeception tests for demo content
command: make tests:codeception -- -g demo-content

- store_artifacts:
path: tests/_output
path: tests/_output/

- store_test_results:
path: tests/end-to-end/results

split_and_push:
docker:
- image: buildpack-deps:trusty
steps:
- add_ssh_keys
- checkout
- run:
name: Split monorepo into child repositories for releasing.
command: .circleci/split/split.sh

workflows:
version: 2

build_and_test:
jobs:
- build_and_test
- build_and_test:
filters:
branches:
ignore:
- master

release:
jobs:
- build_and_test:
filters:
branches:
only:
- master

- split_and_push:
requires:
- build_and_test
26 changes: 26 additions & 0 deletions .circleci/split/split.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Inspired by Laravel monorepo setup. See:
# - https://github.com/laravel/framework
# - https://github.com/splitsh/lite

set -e
set -x

function split()
{
SHA1=`.circleci/split/splitsh-lite --prefix=$1`
git push $2 "$SHA1:master" -f
}

function remote()
{
git remote add $1 $2 || true
}

git pull origin master

remote falcon git@github.com:systemseed/falcon-backend.git
remote falconjs git@github.com:systemseed/falcon.js.git

split 'falcon' falcon
split 'falconjs/packages/falcon' falconjs
Binary file added .circleci/split/splitsh-lite
Binary file not shown.
Binary file added .circleci/split/splitsh-lite-darwin
Binary file not shown.
6 changes: 3 additions & 3 deletions .docker/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SSL certificates.
/certs/*
!/certs/.gitkeep
# Composer cache
/composer
!/composer/.gitkeep

# Docker mysql storage.
/mysql/*
Expand Down
24 changes: 17 additions & 7 deletions .docker/docker-compose.override.default.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
version: '2'
version: '3'

services:

node:
volumes:
- ../falconjs:/falconjs:cached
- ../tests/end-to-end:/tests:cached

mariadb:
volumes:
- ${MYSQL_DATA_DIR}/${MYSQL_DATA_DIR_DRUPAL}:/var/lib/mysql:cached
- ${MYSQL_DATA_DIR}:/var/lib/mysql:cached

php:
environment:
TEST_USERS_PASSWORD: ${TEST_USERS_PASSWORD}
ENVIRONMENT: ${ENVIRONMENT}
# environment:
## Read instructions at https://wodby.com/stacks/drupal/docs/local/xdebug/
# PHP_XDEBUG: 1
# PHP_XDEBUG_DEFAULT_ENABLE: 1
Expand All @@ -20,11 +23,12 @@ services:
# PHP_XDEBUG_REMOTE_HOST: 10.254.254.254 # macOS, Docker < 18.03
# PHP_XDEBUG_REMOTE_HOST: 10.0.75.1 # Windows, Docker < 18.03
volumes:
- ../:/var/www/html:cached
- ../falcon/:/var/www/html:cached
- ./composer:/home/wodby/.composer/cache:cached

nginx:
volumes:
- ../:/var/www/html:cached
- ../falcon/:/var/www/html:cached

codecept:
# environment:
Expand Down Expand Up @@ -66,3 +70,9 @@ services:
# - 'traefik.backend=${PROJECT_NAME}_pma'
# - 'traefik.port=80'
# - 'traefik.frontend.rule=Host:pma.${PROJECT_BASE_URL}'

testcafe:
volumes:
- ../tests/end-to-end/tests:/tests:ro
- ../tests/end-to-end/node_modules:/node_modules:ro
- ../tests/end-to-end/results:/results:cached
77 changes: 49 additions & 28 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
version: '2'
version: '3'

services:

node:
image: wodby/node:$NODE_TAG
container_name: "${PROJECT_NAME}_node"
working_dir: /falconjs
environment:
DEBUG: ${NODE_DEBUG}
ENVIRONMENT: ${ENVIRONMENT}
BACKEND_URL: ${BACKEND_URL}
FRONTEND_URL: ${FRONTEND_URL}
CONSUMER_ID: ${CONSUMER_ID}
PAYMENT_SECRET_HEADER_NAME: ${PAYMENT_SECRET_HEADER_NAME}
HTTP_AUTH_USER: ${HTTP_AUTH_USER}
HTTP_AUTH_PASS: ${HTTP_AUTH_PASS}
labels:
- 'traefik.backend=node'
- 'traefik.port=3000'
- 'traefik.frontend.rule=Host:${FRONTEND_HOST}'
expose:
- "3000"
command: yarn start:dev

mariadb:
image: wodby/mariadb:$MARIADB_TAG
container_name: "${PROJECT_NAME}_mariadb"
Expand All @@ -15,8 +36,6 @@ services:
php:
image: wodby/drupal-php:$PHP_TAG
container_name: "${PROJECT_NAME}_php"
depends_on:
- mariadb
environment:
PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
DB_HOST: $DB_HOST
Expand All @@ -25,6 +44,12 @@ services:
DB_NAME: $DB_NAME
DB_DRIVER: $DB_DRIVER
COLUMNS: 80 # Set 80 columns for docker exec -it.
ENVIRONMENT: ${ENVIRONMENT}
TEST_USERS_PASSWORD: ${TEST_USERS_PASSWORD}
PAYMENT_SECRET_HEADER_NAME: ${PAYMENT_SECRET_HEADER_NAME}
PAYMENT_SECRET_HEADER_VALUE: ${PAYMENT_SECRET_HEADER_VALUE}
HTTP_AUTH_USER: ${HTTP_AUTH_USER}
HTTP_AUTH_PASS: ${HTTP_AUTH_PASS}

nginx:
image: wodby/nginx:$NGINX_TAG
Expand All @@ -36,11 +61,11 @@ services:
NGINX_ERROR_LOG_LEVEL: debug
NGINX_BACKEND_HOST: php
NGINX_SERVER_ROOT: /var/www/html/web
NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET
NGINX_VHOST_PRESET: drupal8
labels:
- 'traefik.backend=nginx'
- 'traefik.port=80'
- 'traefik.frontend.rule=Host:falcon.${PROJECT_BASE_URL}'
- 'traefik.frontend.rule=Host:${BACKEND_HOST}'

mailhog:
image: mailhog/mailhog
Expand All @@ -50,40 +75,21 @@ services:
- 'traefik.port=8025'
- 'traefik.frontend.rule=Host:mailhog.${PROJECT_BASE_URL}'

portainer:
image: portainer/portainer
container_name: "${PROJECT_NAME}_portainer"
command: --no-auth -H unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
- 'traefik.backend=portainer'
- 'traefik.port=9000'
- 'traefik.frontend.rule=Host:portainer.${PROJECT_BASE_URL}'

traefik:
image: traefik
container_name: "${PROJECT_NAME}_traefik"
command: -c /dev/null --web --docker --logLevel=INFO --defaultEntryPoints='https,http' --entryPoints='Name:https Address::443 TLS:/certs/cert.pem,/certs/key.pem' --entryPoints='Name:http Address::80'
command: -c /dev/null --web --docker --logLevel=INFO --defaultEntryPoints='https,http' --entryPoints='Name:http Address::80'
ports:
- '80:80'
- '443:443'
- '8080:8080' # Dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./certs:/certs
networks:
default:
aliases:
- falcon.${PROJECT_BASE_URL}

omgwtfssl:
image: paulczar/omgwtfssl
container_name: "${PROJECT_NAME}_ssl"
environment:
SSL_SUBJECT: ${PROJECT_BASE_URL}
volumes:
- ./certs:/certs
- ${BACKEND_HOST}
- ${FRONTEND_HOST}

codecept:
image: systemseed/codeception:2.5.2-1.0-drupal
Expand All @@ -93,6 +99,21 @@ services:
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME}
URL: 'http://falcon.${PROJECT_BASE_URL}'
BACKEND_URL: ${BACKEND_URL}
FRONTEND_URL: ${FRONTEND_URL}
TEST_USERS_PASSWORD: ${TEST_USERS_PASSWORD}
DEVELOPMENT_MODULES: ${DEVELOPMENT_MODULES}

testcafe:
image: testcafe/testcafe:alpha
shm_size: 1g
ports:
- "1337:1337"
- "1338:1338"
environment:
# Remove screen height workaround when https://github.com/DevExpress/testcafe/issues/3461 is resolved.
SCREEN_HEIGHT: 6000
BACKEND_URL: ${BACKEND_URL}
FRONTEND_URL: ${FRONTEND_URL}
HTTP_AUTH_USER: ${HTTP_AUTH_USER}
HTTP_AUTH_PASS: ${HTTP_AUTH_PASS}
30 changes: 25 additions & 5 deletions .env.default
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# docker4drupal variables.
PROJECT_NAME=falcon

FRONTEND_HOST=app.docker.localhost
BACKEND_HOST=falcon.docker.localhost
FRONTEND_URL=http://app.docker.localhost
BACKEND_URL=http://falcon.docker.localhost

PROJECT_BASE_URL=docker.localhost

DB_NAME=drupal
Expand All @@ -11,25 +17,39 @@ DB_DRIVER=mysql

MARIADB_TAG=10.1-3.2.2
# MacOS.
PHP_TAG=7.2-dev-macos-4.6.0
PHP_TAG=7.3-dev-macos-4.13.0
# Linux.
# PHP_TAG=7.2-dev-4.6.0
# PHP_TAG=7.3-dev-4.13.0
NGINX_TAG=1.13-5.0.0
NGINX_VHOST_PRESET=drupal8
NODE_TAG=10.16-0.18.0

# Docker-compose environment variables - see https://docs.docker.com/compose/reference/envvars/
COMPOSE_FILE=./.docker/docker-compose.yml:./.docker/docker-compose.override.yml
COMPOSE_PROJECT_NAME=falcon

ENVIRONMENT=development
DEVELOPMENT_MODULES=devel falcon_development reroute_email config_update_ui features_ui config_distro config_merge config_provider config_snapshot config_sync
ADDITIONAL_MODULES=rest_entity_recursive falcon_feature_thankq falcon_thankq falcon_navigation falcon_gift_ecards falcon_feature_commerce_example_gateway falcon_feature_example falcon_feature_gifts falcon_feature_gifts_bundle falcon_feature_gift_cards falcon_feature_gifts_bundle_cards falcon_feature_mail falcon_feature_rest_entity_recursive falcon_feature_webform
ADDITIONAL_MODULES=rest_entity_recursive falcon_feature_thankq falcon_thankq falcon_navigation falcon_gift_ecards falcon_feature_commerce_example_gateway falcon_feature_example falcon_feature_gifts falcon_feature_gifts_bundle falcon_feature_gift_cards falcon_feature_gifts_bundle_cards falcon_feature_mail falcon_feature_webform
TEST_USERS_PASSWORD=secure_password
DOCKER_PHPCS=willhallonline/drupal-phpcs:alpine
DOCKER_ESLINT=savoirfairelinux/eslint-airbnb:latest

NODE_DEBUG=falcon:*

# Local environment variables.
# On Linux machines you can put DB into memory - /dev/shm
# Possible values: ./mysql | /dev/shm
MYSQL_DATA_DIR=./mysql
MYSQL_DATA_DIR_DRUPAL=falcon

# Consumer id
CONSUMER_ID=114e3e1a-6f65-49a8-9a24-v0043fabd6e7

# Payment secret header name/value to enable test payment mode.
PAYMENT_SECRET_HEADER_NAME=X-Payment-Secret
PAYMENT_SECRET_HEADER_VALUE=19pSIj1N5w5GFpeD88DssKEUe4QFwpE2

HTTP_AUTH_USER=''
HTTP_AUTH_PASS=''

# Tests
TESTCAFE_BROWSERS=chromium:emulation:device=iphone X --no-sandbox,chromium --no-sandbox

0 comments on commit 997033b

Please sign in to comment.