-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
test
committed
May 23, 2019
1 parent
fa6ed9c
commit 45f134a
Showing
63 changed files
with
1,291 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{% set blocks = '_twig/docker-compose.yml/' %} | ||
{% set dockersync = false %} | ||
{% if @('host.os') == 'darwin' and @('docker-sync') == 'yes' %} | ||
{% set dockersync = true %} | ||
{% endif %} | ||
|
||
console: | ||
{% if @('app.build') == 'dynamic' %} | ||
build: | ||
context: ./ | ||
dockerfile: .my127ws/docker/image/console/Dockerfile | ||
entrypoint: /entrypoint.dynamic.sh | ||
volumes: | ||
- {{ (dockersync) ? @('workspace.name') ~ '-sync:/app:nocopy' : './:/app:delegated' }} | ||
- ./.my127ws/application:/home/build/application | ||
- ./.my127ws/docker/image/console/root/lib/task:/lib/task | ||
- ./.my127ws:/.my127ws | ||
{% else %} | ||
image: {{ @('docker.repository') ~ ':' ~ @('app.version') ~ '-console' }} | ||
{% endif %} | ||
labels: | ||
- traefik.enable=false | ||
environment: &APP_ENV_VARS | ||
{% include blocks ~ 'environment.yml.twig' %} | ||
networks: | ||
- private | ||
|
||
nginx: | ||
{% if @('app.build') == 'dynamic' %} | ||
build: .my127ws/docker/image/nginx | ||
volumes: | ||
- {{ (dockersync) ? @('workspace.name') ~ '-sync:/app:nocopy' : './:/app:delegated' }} | ||
{% else %} | ||
image: {{ @('docker.repository') ~ ':' ~ @('app.version') ~ '-nginx' }} | ||
{% endif %} | ||
labels: | ||
- traefik.backend={{ @('workspace.name') }} | ||
- traefik.frontend.rule=Host:{{ @('hostname') }} | ||
- traefik.docker.network=my127ws | ||
- traefik.port=80 | ||
links: | ||
- php-fpm:php-fpm | ||
networks: | ||
private: | ||
aliases: | ||
- {{ @('hostname') }} | ||
shared: {} | ||
|
||
php-fpm: | ||
{% if @('app.build') == 'dynamic' %} | ||
build: .my127ws/docker/image/php-fpm | ||
entrypoint: /entrypoint.dynamic.sh | ||
volumes: | ||
- {{ (dockersync) ? @('workspace.name') ~ '-sync:/app:nocopy' : './:/app:delegated' }} | ||
- ./.my127ws:/.my127ws | ||
{% else %} | ||
image: {{ @('docker.repository') ~ ':' ~ @('app.version') ~ '-php-fpm' }} | ||
{% endif %} | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private | ||
environment: | ||
<<: *APP_ENV_VARS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
chrome: | ||
image: yukinying/chrome-headless-browser:latest | ||
command: ["--no-sandbox", "--disable-gpu", "--headless", "--disable-dev-shm-usage", "--remote-debugging-address=0.0.0.0", "--remote-debugging-port=9222", "--user-data-dir=/data"] | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
memcached: | ||
image: memcached:1-alpine | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mysql: | ||
image: mysql:5.7 | ||
labels: | ||
- traefik.enable=false | ||
environment: | ||
- MYSQL_ROOT_PASSWORD={{ @('database.root_pass') }} | ||
- MYSQL_DATABASE={{ @('database.name') }} | ||
- MYSQL_USER={{ @('database.user') }} | ||
- MYSQL_PASSWORD={{ @('database.pass') }} | ||
networks: | ||
- private | ||
ports: | ||
- 3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
postgres: | ||
image: postgres:9.6 | ||
labels: | ||
- traefik.enable=false | ||
environment: | ||
- POSTGRES_DB={{ @('database.name') }} | ||
- POSTGRES_USER={{ @('database.user') }} | ||
- POSTGRES_PASSWORD={{ @('database.pass') }} | ||
networks: | ||
- private | ||
ports: | ||
- 5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
redis-session: | ||
image: redis:4-alpine | ||
# 1GB; evict key that would expire soonest | ||
command: redis-server --maxmemory 1073742000 --maxmemory-policy volatile-ttl --save 3600 1 --save 300 100 --save 60 10000 | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
redis: | ||
image: redis:4-alpine | ||
# 1GB; evict any least recently used key even if they don't have a TTL | ||
command: redis-server --maxmemory 1073742000 --maxmemory-policy allkeys-lru --save 3600 1 --save 300 100 --save 60 10000 | ||
labels: | ||
- traefik.enable=false | ||
networks: | ||
- private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% set build = @('app.build') %} | ||
{% set blocks = 'application/overlay/_twig/.dockerignore/' %} | ||
|
||
{% if build == 'dynamic' %} | ||
{% include blocks ~ 'dynamic.twig' %} | ||
{% else %} | ||
{% include blocks ~ 'static.twig' %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
pipeline { | ||
agent { label "my127ws" } | ||
environment { | ||
MY127WS_KEY = credentials('{{ @('workspace.name') }}-my127ws-key') | ||
MY127WS_ENV = "pipeline" | ||
} | ||
triggers { cron(env.BRANCH_NAME == '{{ @('git.main_branch') }}' ? 'H H(0-6) * * *' : '') } | ||
stages { | ||
stage('Build') { | ||
steps { sh 'ws install' } | ||
} | ||
stage('Test') { | ||
parallel { | ||
stage('quality') { steps { sh 'ws exec composer test-quality' } } | ||
stage('unit') { steps { sh 'ws exec composer test-unit' } } | ||
stage('acceptance') { steps { sh 'ws exec composer test-acceptance' } } | ||
} | ||
} | ||
{% if @('pipeline.publish.enabled') == 'yes' %} | ||
stage('Publish') { | ||
when { not { triggeredBy 'TimerTrigger' } } | ||
steps { sh 'ws app publish' } | ||
} | ||
{% endif %} | ||
{% if @('pipeline.preview.enabled') == 'yes' %} | ||
stage('Deploy') { | ||
when { not { triggeredBy 'TimerTrigger' } } | ||
steps { sh 'ws app deploy preview' } | ||
} | ||
{% endif %} | ||
} | ||
post { | ||
always { | ||
sh 'ws destroy' | ||
cleanWs() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.my127ws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# no need for exclusions for now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"http-basic": { | ||
{% for repo in @('composer.auth.basic') %} | ||
"{{ repo.path }}": { | ||
"username": "{{ repo.username }}", | ||
"password": "{{ repo.password }}" | ||
}{% if not loop.last %},{% endif %} | ||
{% endfor %} | ||
}, | ||
"github-oauth": { | ||
{% if @('composer.auth.github') %} | ||
"github.com": "{{ @('composer.auth.github') }}" | ||
{% endif %} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# {{ @('workspace.name') }} | ||
|
||
Please follow the below steps to get started, if you encounter any issues installing the dependencies or provisioning the development environment, please check the [Common Issues](#common-issues) section first. | ||
|
||
## Development Environment | ||
|
||
### Getting Started | ||
|
||
#### Prerequisites | ||
|
||
##### General | ||
|
||
- Access to LastPass folders | ||
- `Shared-{{ @('workspace.name') }}-Servers` and `Shared-{{ @('workspace.name') }}-Accounts` | ||
|
||
##### Docker | ||
|
||
- A working Docker setup | ||
- On MacOS, use [Docker for Mac](https://docs.docker.com/docker-for-mac/install/). | ||
- On Linux, add the official Docker repository and install the "docker-ce" package. | ||
You will also need to have a recent [docker-compose](https://docs.docker.com/compose/install/) version - at least `1.24.0`. | ||
|
||
#### Setup | ||
|
||
1. Install [workspace](https://github.com/my127/workspace) | ||
2. Copy the LastPass entry "{{ @('workspace.name') }}: Development Environment Key" to a file named `workspace.override.yml` in the project root. | ||
3. Run `ws install` | ||
|
||
Once installed, the site should be available at [https://{{ @('hostname') }}](https://{{ @('hostname') }}). | ||
|
||
### Development environment cleanup | ||
|
||
To stop the development environment, run `ws disable`. | ||
|
||
To start the development environment again, run `ws enable`. | ||
|
||
To remove the development environment, run `ws destroy`. | ||
|
||
### Frontend | ||
|
||
The frontend build should be automatically done as part of bringing up the environment. | ||
|
||
To trigger a rebuild, run `ws frontend build`. | ||
|
||
To watch for changes, run `ws frontend watch`. | ||
|
||
To gain access to the `console` container where the builds happen: `ws frontend console`. | ||
|
||
### Xdebug | ||
|
||
Xdebug is turned off by default as it drastically slows down requests for all developers. | ||
|
||
To enable, set `attribute('php.ext-xdebug.enable'): yes` in your `workspace.override.yml` and then run: | ||
```bash | ||
ws service php-fpm restart | ||
``` | ||
|
||
To enable on CLI in `ws console`, set `attribute('php.ext-xdebug.cli.enable'): yes` in your `workspace.override.yml` and then run: | ||
```bash | ||
ws service php-fpm restart | ||
``` | ||
|
||
Xdebug is set up to listen to your computer's 9000 port once enabled, so all you would need to do in your IDE is listen for connections. [Here's a good guide for PhpStorm](https://www.jetbrains.com/help/PhpStorm/zero-configuration-debugging.html). | ||
|
||
If you have trouble with Xdebug not calling back, check that `sudo lsof -i :9000 | grep LISTEN` on your host shows a PhpStorm process. If it doesn't, stop that process and toggle the Xdebug listen button in PhpStorm again. | ||
|
||
### Common Issues | ||
|
||
As setup issues are encountered please detail with step by step fix instructions, and where possible update the project or the upstream workspace harness itself to provide a more permanent fix. | ||
|
||
# License | ||
|
||
Copyright 2019, Inviqa | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{% set blocks = '_twig/docker-compose.yml/' %} | ||
{% set dockersync = false %} | ||
{% if @('host.os') == 'darwin' and @('docker-sync') == 'yes' %} | ||
{% set dockersync = true %} | ||
{% endif %} | ||
version: '3' | ||
services: | ||
{% include blocks ~ 'application.yml.twig' %} | ||
{% for service in @('app.services') %} | ||
{% include blocks ~ 'service/' ~ service ~ '.yml.twig' %} | ||
{% endfor %} | ||
networks: | ||
private: | ||
external: false | ||
shared: | ||
external: | ||
name: my127ws | ||
{% if dockersync %} | ||
volumes: | ||
{{ @('workspace.name') }}-sync: | ||
external: true | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '2' | ||
options: | ||
compose-file-path: | ||
- docker-compose.yml | ||
project_root: config_path | ||
syncs: | ||
{{ @('workspace.name') }}-sync: | ||
src: ./ | ||
sync_userid: '1000' | ||
sync_excludes_type: BelowPath | ||
sync_excludes: &IGNORE | ||
- .docker-sync | ||
- .idea | ||
- .my127ws | ||
- .git | ||
- var | ||
watch_excludes: *IGNORE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.twig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM {{ @('docker.image.console') }} | ||
|
||
COPY .my127ws/docker/image/console/root / | ||
RUN chown -R build:build /home/build | ||
|
||
ENV APP_MODE={{ @('app.mode') }} \ | ||
ASSETS_DIR={{ @('assets.local') }} | ||
|
||
{% if @('node.version') is not null %} | ||
USER build | ||
RUN . /home/build/.nvm/nvm.sh \ | ||
&& nvm install {{ @('node.version') }} \ | ||
&& nvm use {{ @('node.version') }} \ | ||
&& nvm alias default {{ @('node.version') }} \ | ||
&& npm install -g yarn | ||
USER root | ||
{% endif %} | ||
|
||
{% if @('app.build') == 'static' %} | ||
RUN chown build:build /app | ||
COPY --chown=build:build .my127ws/application /home/build/application | ||
COPY --chown=build:build ./ /app | ||
USER build | ||
RUN app build | ||
USER root | ||
{% else %} | ||
VOLUME /app | ||
VOLUME /home/build/application | ||
{% endif %} | ||
|
||
ENTRYPOINT /entrypoint.sh |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
main() | ||
{ | ||
task "$@" | ||
} | ||
|
||
bootstrap() | ||
{ | ||
export NVM_DIR="$HOME/.nvm" | ||
# shellcheck source=/home/build/nvm.sh | ||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | ||
. /lib/sidekick.sh | ||
} | ||
|
||
bootstrap | ||
main "$@" |
Oops, something went wrong.