et_full_system 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +115 -0
- data/LICENSE.txt +21 -0
- data/README.md +194 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docker/Dockerfile +103 -0
- data/docker/docker-compose.yml +95 -0
- data/et_full_system.gemspec +41 -0
- data/exe/et_full_system +22 -0
- data/foreman/.env +32 -0
- data/foreman/.foreman +1 -0
- data/foreman/Procfile +12 -0
- data/foreman/et1.env +16 -0
- data/foreman/et3.env +3 -0
- data/foreman/et_admin.env +8 -0
- data/foreman/et_api.env +7 -0
- data/foreman/et_atos.env +3 -0
- data/foreman/mailhog.env +3 -0
- data/foreman/minio.env +2 -0
- data/foreman/ports.env +4 -0
- data/foreman/s3/.env +5 -0
- data/foreman/traefik.json +188 -0
- data/foreman/traefik.toml +38 -0
- data/lib/et_full_system/cli/docker/server.rb +33 -0
- data/lib/et_full_system/cli/docker.rb +64 -0
- data/lib/et_full_system/cli/local/file_storage.rb +60 -0
- data/lib/et_full_system/cli/local.rb +303 -0
- data/lib/et_full_system/cli.rb +2 -0
- data/lib/et_full_system/version.rb +3 -0
- data/lib/et_full_system.rb +5 -0
- data/shell_scripts/docker_bootstrap.sh +20 -0
- data/shell_scripts/run_foreman +32 -0
- metadata +188 -0
@@ -0,0 +1,95 @@
|
|
1
|
+
version: '3'
|
2
|
+
services:
|
3
|
+
et:
|
4
|
+
image: 'et_full_system:0.1.17'
|
5
|
+
build:
|
6
|
+
context: ../
|
7
|
+
dockerfile: docker/Dockerfile
|
8
|
+
|
9
|
+
ports:
|
10
|
+
- '${SERVER_PORT:-3100}:${SERVER_PORT:-3100}'
|
11
|
+
- '${TRAEFIX_PORT:-3200}:${TRAEFIK_PORT:-3200}'
|
12
|
+
- '${SMTP_PORT:-1025}:${SMTP_PORT:-1025}'
|
13
|
+
volumes:
|
14
|
+
- rvm:/usr/local/rvm
|
15
|
+
- global_node_modules:/usr/lib/node_modules
|
16
|
+
- ${PWD}:/home/app/full_system
|
17
|
+
- et1_node_modules:/home/app/full_system/systems/et1/node_modules
|
18
|
+
- et3_node_modules:/home/app/full_system/systems/et3/node_modules
|
19
|
+
- api_node_modules:/home/app/full_system/systems/api/node_modules
|
20
|
+
- admin_node_modules:/home/app/full_system/systems/admin/node_modules
|
21
|
+
- et1_assets:/home/app/full_system/systems/et1/public/apply/assets
|
22
|
+
- et3_assets:/home/app/full_system/systems/et3/public/assets
|
23
|
+
- admin_assets:/home/app/full_system/systems/admin/public/assets
|
24
|
+
- s3_data:/home/app/minio_data
|
25
|
+
- azure_storage_data:/home/app/azure_storage_data
|
26
|
+
- et1_bundle:/home/app/full_system/systems/et1/.bundle
|
27
|
+
- et3_bundle:/home/app/full_system/systems/et3/.bundle
|
28
|
+
- api_bundle:/home/app/full_system/systems/api/.bundle
|
29
|
+
- atos_bundle:/home/app/full_system/systems/atos/.bundle
|
30
|
+
- admin_bundle:/home/app/full_system/systems/admin/.bundle
|
31
|
+
environment:
|
32
|
+
DISABLE_CLOUDWATCH: 'true'
|
33
|
+
DB_HOST: 'db'
|
34
|
+
DB_USERNAME: 'postgres'
|
35
|
+
RAILS_ENV:
|
36
|
+
RAILS_LOG_LEVEL:
|
37
|
+
REDIS_HOST: redis
|
38
|
+
SERVER_PORT: ${SERVER_PORT:-3100}
|
39
|
+
SERVER_DOMAIN: ${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
40
|
+
CLOUD_PROVIDER: ${CLOUD_PROVIDER:-amazon}
|
41
|
+
AZURITE_STORAGE_PATH: /home/app/azure_storage_data
|
42
|
+
MINIO_STORAGE_PATH: /home/app/minio_data
|
43
|
+
command: /bin/bash --login -c "cd /home/app/full_system && et_full_system local server"
|
44
|
+
links:
|
45
|
+
- "db"
|
46
|
+
- "redis"
|
47
|
+
networks:
|
48
|
+
et_full_system:
|
49
|
+
aliases:
|
50
|
+
- api.${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
51
|
+
- admin.${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
52
|
+
- et1.${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
53
|
+
- et3.${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
54
|
+
- s3.${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
55
|
+
- azure_blob_storage.${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
56
|
+
- azure.${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
57
|
+
- atos.${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
58
|
+
- mail.${SERVER_DOMAIN:-et.127.0.0.1.nip.io}
|
59
|
+
|
60
|
+
#command: bash -lc "cd /home/app/full_system/systems/api && REDIS_DATABASE=2 bundle exec sidekiq"
|
61
|
+
db:
|
62
|
+
image: postgres:9.6.9
|
63
|
+
networks:
|
64
|
+
- et_full_system
|
65
|
+
ports:
|
66
|
+
- "${DB_PORT:-0}:5432"
|
67
|
+
redis:
|
68
|
+
image: redis
|
69
|
+
ports:
|
70
|
+
- "${REDIS_PORT:-0}:6379"
|
71
|
+
networks:
|
72
|
+
- et_full_system
|
73
|
+
|
74
|
+
volumes:
|
75
|
+
rvm:
|
76
|
+
global_node_modules:
|
77
|
+
et1_node_modules:
|
78
|
+
et3_node_modules:
|
79
|
+
s3_node_modules:
|
80
|
+
api_node_modules:
|
81
|
+
admin_node_modules:
|
82
|
+
et1_assets:
|
83
|
+
et3_assets:
|
84
|
+
admin_assets:
|
85
|
+
s3_data:
|
86
|
+
azure_storage_data:
|
87
|
+
et1_bundle:
|
88
|
+
et3_bundle:
|
89
|
+
admin_bundle:
|
90
|
+
api_bundle:
|
91
|
+
atos_bundle:
|
92
|
+
networks:
|
93
|
+
et_full_system:
|
94
|
+
|
95
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "et_full_system/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "et_full_system"
|
8
|
+
spec.version = EtFullSystem::VERSION
|
9
|
+
spec.authors = ["Gary Taylor"]
|
10
|
+
spec.email = ["gary.taylor@hmcts.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{Runs the employment tribunals system - all services and background jobs}
|
13
|
+
spec.description = %q{Runs the employment tribunals system - all services and background jobs}
|
14
|
+
spec.homepage = "https://github.com/ministryofjustice/et-full-system"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "http://mygemserver.com"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
# Specify which files should be added to the gem when it is released.
|
27
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
28
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
29
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
30
|
+
end
|
31
|
+
spec.bindir = "exe"
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
spec.add_dependency 'thor', '~> 0.20'
|
35
|
+
spec.add_dependency 'httparty', '~> 0.16'
|
36
|
+
spec.add_dependency 'aws-sdk-s3', '~> 1.9'
|
37
|
+
spec.add_dependency 'azure-storage', '~> 0.15.0.preview'
|
38
|
+
spec.add_dependency 'dotenv', '~> 2.7', '>= 2.7.2'
|
39
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
40
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
41
|
+
end
|
data/exe/et_full_system
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
require "rubygems"
|
4
|
+
require "thor"
|
5
|
+
require "et_full_system/cli"
|
6
|
+
module EtFullSystem
|
7
|
+
class RootCommand < Thor
|
8
|
+
desc "local command(s)", "Performs commands on a local server (non docker)"
|
9
|
+
subcommand "local", LocalCommand
|
10
|
+
|
11
|
+
desc "docker command(s)", "Performs commands on a docker server"
|
12
|
+
subcommand "docker", DockerCommand
|
13
|
+
|
14
|
+
desc "version", "Shows the version of et_full_system"
|
15
|
+
def version
|
16
|
+
puts ::EtFullSystem::VERSION
|
17
|
+
end
|
18
|
+
|
19
|
+
map "--version": :version
|
20
|
+
end
|
21
|
+
end
|
22
|
+
EtFullSystem::RootCommand.start
|
data/foreman/.env
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
RAILS_ENV=production
|
2
|
+
DB_HOST=${DB_HOST}
|
3
|
+
DB_USERNAME=postgres
|
4
|
+
REDIS_HOST=${REDIS_HOST}
|
5
|
+
RAILS_LOG_TO_STDOUT='true'
|
6
|
+
WEB_CONCURRENCY=1
|
7
|
+
SECRET_KEY_BASE=sdlkjewfkjhfviuhduihenrjk435r89esfd7cv983qh2n4r3q27yh4u5rtfg
|
8
|
+
SMTP_HOSTNAME='mail.et.127.0.0.1.nip.io'
|
9
|
+
SMTP_PORT=1025
|
10
|
+
AWS_ACCESS_KEY_ID=accessKey1
|
11
|
+
AWS_SECRET_ACCESS_KEY=verySecretKey1
|
12
|
+
AWS_REGION='us-east-1'
|
13
|
+
AWS_ENDPOINT='http://s3.et.127.0.0.1.nip.io:3100'
|
14
|
+
AWS_S3_FORCE_PATH_STYLE='true'
|
15
|
+
RAILS_SERVE_STATIC_FILES='true'
|
16
|
+
ATOS_API_URL="http://atos.et.127.0.0.1.nip.io:3100"
|
17
|
+
ACAS_API_URL="http://api.et.127.0.0.1.nip.io:3100/et_acas_api"
|
18
|
+
ATOS_API_USERNAME='atos'
|
19
|
+
ATOS_API_PASSWORD='password'
|
20
|
+
RAILS_MAX_THREADS=5
|
21
|
+
AZURITE_STORAGE_PATH=${AZURITE_STORAGE_PATH}
|
22
|
+
MINIO_STORAGE_PATH=${MINIO_STORAGE_PATH}
|
23
|
+
DISABLE_CLOUDWATCH='true'
|
24
|
+
AZURE_STORAGE_BLOB_HOST='http://azure_blob_storage.et.127.0.0.1.nip.io:3100'
|
25
|
+
AZURE_STORAGE_BLOB_FORCE_PATH_STYLE='true'
|
26
|
+
AZURE_STORAGE_ACCOUNT='devstoreaccount1'
|
27
|
+
AZURE_STORAGE_ACCESS_KEY='Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=='
|
28
|
+
AZURE_STORAGE_CONTAINER='et-api-test-container'
|
29
|
+
AZURE_STORAGE_DIRECT_UPLOAD_ACCOUNT='devstoreaccount1'
|
30
|
+
AZURE_STORAGE_DIRECT_UPLOAD_ACCESS_KEY='Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=='
|
31
|
+
AZURE_STORAGE_DIRECT_UPLOAD_CONTAINER='et-api-direct-test-container'
|
32
|
+
|
data/foreman/.foreman
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
env: ports.env
|
data/foreman/Procfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
traefik: bash --login -c "traefik --file.filename=${FOREMAN_PATH}/traefik.toml"
|
2
|
+
et1_web: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url et1 http://localhost:${PORT} && cd systems/et1 && dotenv -f ${FOREMAN_PATH}/.env dotenv -f ${FOREMAN_PATH}/et1.env ./run.sh"
|
3
|
+
et1_sidekiq: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && cd systems/et1 && dotenv -f ${FOREMAN_PATH}/.env dotenv -f ${FOREMAN_PATH}/et1.env ./run_sidekiq.sh"
|
4
|
+
et3_web: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url et3 http://localhost:${PORT} && cd systems/et3 && dotenv -f ${FOREMAN_PATH}/.env dotenv -f ${FOREMAN_PATH}/et3.env ./run.sh"
|
5
|
+
mail_web: bash --login -c "source ./mailhog.env && mailhog &> /dev/null"
|
6
|
+
api_web: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url api http://localhost:${PORT} && cd systems/api && dotenv -f ${FOREMAN_PATH}/.env dotenv -f ${FOREMAN_PATH}/et_api.env ./run.sh"
|
7
|
+
api_sidekiq: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && cd systems/api && dotenv -f ${FOREMAN_PATH}/.env dotenv -f ${FOREMAN_PATH}/et_api.env ./run_sidekiq.sh"
|
8
|
+
admin_web: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url admin http://localhost:${PORT} && cd systems/admin && dotenv -f ${FOREMAN_PATH}/.env dotenv -f ${FOREMAN_PATH}/et_admin.env ./run.sh"
|
9
|
+
atos_api_web: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url atos_api http://localhost:${PORT} && cd systems/atos && dotenv -f ${FOREMAN_PATH}/.env dotenv -f ${FOREMAN_PATH}/et_atos.env ./run.sh"
|
10
|
+
s3_web: bash --login -c "dotenv -f ${FOREMAN_PATH}/minio.env minio server ${MINIO_STORAGE_PATH}"
|
11
|
+
azure_blob_web: bash --login -c "azurite -l ${AZURITE_STORAGE_PATH}"
|
12
|
+
fake_acas_web: bash --login -c "cd ${FS_ROOT_PATH} && et_full_system local wait_for_support && et_full_system local update_service_url fake_acas http://localhost:${PORT} && rvm use && et_fake_acas_server --port=$PORT --threads=1:5"
|
data/foreman/et1.env
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
DB_NAME=et1db
|
2
|
+
HTTP_OPEN_TIMEOUT_S=15
|
3
|
+
HTTP_READ_TIMEOUT_S=15
|
4
|
+
REDIS_DATABASE=5
|
5
|
+
S3_UPLOAD_BUCKET='et1bucket'
|
6
|
+
RAVEN_DSN='https://1b78623c8bab4dfb9aeb6f5dbb31ae34:0f4a38359e7e47f99e7e69449b32ef2b@sentry.io/1355286'
|
7
|
+
AWS_ACCESS_KEY_ID=accessKey1
|
8
|
+
AWS_SECRET_ACCESS_KEY=verySecretKey1
|
9
|
+
S3_UPLOAD_BUCKET=et1bucket
|
10
|
+
AWS_REGION=us-east-1
|
11
|
+
AWS_ENDPOINT=http://s3.et.127.0.0.1.nip.io:3100
|
12
|
+
AWS_S3_FORCE_PATH_STYLE=true
|
13
|
+
ET_API_URL='http://api.et.127.0.0.1.nip.io:3100/api/v2'
|
14
|
+
SECURE_SESSION_COOKIE=false
|
15
|
+
SENDING_HOST=et1.et.127.0.0.1.nip.io
|
16
|
+
FLATTEN_PDF=false
|
data/foreman/et3.env
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
DEVISE_SECRET_KEY=JK3N45KH56743JN25J1B5H43B24H35BJ6575KN21NRNKFASDF89DU23I4NK5TGKFD
|
2
|
+
REDIS_DATABASE=2
|
3
|
+
RAILS_SERVE_STATIC_FILES='true'
|
4
|
+
SEED_EXAMPLE_USERS='true'
|
5
|
+
S3_UPLOAD_BUCKET='etapibucket'
|
6
|
+
RAVEN_DSN='https://ff44444af15e43a287fa10eb4f3fd825:b5764132fc3a42e98d8a7f8ba3042a90@sentry.io/1389908'
|
7
|
+
ET_API_URL='http://api.et.127.0.0.1.nip.io:3100/api'
|
8
|
+
|
data/foreman/et_api.env
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
WEB_CONCURRENCY=1
|
2
|
+
SECRET_KEY_BASE=sdlkjewfkjhfviuhduihenrjk435r89esfd7cv983qh2n4r3q27yh4u5rtfg
|
3
|
+
REDIS_DATABASE=2
|
4
|
+
S3_UPLOAD_BUCKET='etapibucket'
|
5
|
+
S3_DIRECT_UPLOAD_BUCKET='etapidirectbucket'
|
6
|
+
RAVEN_DSN='https://929365547a42468fb521248a96100646:139af8327fa340b88088efeae059fca8@sentry.io/1254109'
|
7
|
+
ACAS_SERVICE_URL='http://acas.et.127.0.0.1.nip.io:3100/Lookup/ECService.svc'
|
data/foreman/et_atos.env
ADDED
data/foreman/mailhog.env
ADDED
data/foreman/minio.env
ADDED
data/foreman/ports.env
ADDED
data/foreman/s3/.env
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
{
|
2
|
+
"backends": {
|
3
|
+
"et1": {
|
4
|
+
"servers": {
|
5
|
+
"web": {
|
6
|
+
"url": "http://localhost:5101",
|
7
|
+
"weight": 1
|
8
|
+
}
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"et3": {
|
12
|
+
"servers": {
|
13
|
+
"web": {
|
14
|
+
"url": "http://localhost:5601",
|
15
|
+
"weight": 1
|
16
|
+
}
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"admin": {
|
20
|
+
"servers": {
|
21
|
+
"web": {
|
22
|
+
"url": "http://localhost:7801",
|
23
|
+
"weight": 1
|
24
|
+
}
|
25
|
+
}
|
26
|
+
},
|
27
|
+
"api": {
|
28
|
+
"servers": {
|
29
|
+
"web": {
|
30
|
+
"url": "http://localhost:6501",
|
31
|
+
"weight": 1
|
32
|
+
}
|
33
|
+
}
|
34
|
+
},
|
35
|
+
"atos_api": {
|
36
|
+
"servers": {
|
37
|
+
"web": {
|
38
|
+
"url": "http://localhost:8601",
|
39
|
+
"weight": 1
|
40
|
+
}
|
41
|
+
}
|
42
|
+
},
|
43
|
+
"s3": {
|
44
|
+
"servers": {
|
45
|
+
"web": {
|
46
|
+
"url": "http://localhost:9000",
|
47
|
+
"weight": 1
|
48
|
+
}
|
49
|
+
}
|
50
|
+
},
|
51
|
+
"mail": {
|
52
|
+
"servers": {
|
53
|
+
"web": {
|
54
|
+
"url": "http://localhost:8025",
|
55
|
+
"weight": 1
|
56
|
+
}
|
57
|
+
}
|
58
|
+
},
|
59
|
+
"azure_blob": {
|
60
|
+
"servers": {
|
61
|
+
"web": {
|
62
|
+
"url": "http://localhost:10000",
|
63
|
+
"weight": 1
|
64
|
+
}
|
65
|
+
}
|
66
|
+
},
|
67
|
+
"fake_acas": {
|
68
|
+
"servers": {
|
69
|
+
"web": {
|
70
|
+
"url": "http://localhost:11601",
|
71
|
+
"weight": 1
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
|
77
|
+
},
|
78
|
+
"frontends": {
|
79
|
+
"et1": {
|
80
|
+
"entryPoints": [
|
81
|
+
"http"
|
82
|
+
],
|
83
|
+
"backend": "et1",
|
84
|
+
"passHostHeader": true,
|
85
|
+
"routes": {
|
86
|
+
"test_1": {
|
87
|
+
"rule": "Host:et1.et.127.0.0.1.nip.io"
|
88
|
+
}
|
89
|
+
}
|
90
|
+
},
|
91
|
+
"et3": {
|
92
|
+
"entryPoints": [
|
93
|
+
"http"
|
94
|
+
],
|
95
|
+
"backend": "et3",
|
96
|
+
"passHostHeader": true,
|
97
|
+
"routes": {
|
98
|
+
"test_1": {
|
99
|
+
"rule": "Host:et3.et.127.0.0.1.nip.io"
|
100
|
+
}
|
101
|
+
}
|
102
|
+
},
|
103
|
+
"admin": {
|
104
|
+
"entryPoints": [
|
105
|
+
"http"
|
106
|
+
],
|
107
|
+
"backend": "admin",
|
108
|
+
"passHostHeader": true,
|
109
|
+
"routes": {
|
110
|
+
"test_1": {
|
111
|
+
"rule": "Host:admin.et.127.0.0.1.nip.io"
|
112
|
+
}
|
113
|
+
}
|
114
|
+
},
|
115
|
+
"api": {
|
116
|
+
"entryPoints": [
|
117
|
+
"http"
|
118
|
+
],
|
119
|
+
"backend": "api",
|
120
|
+
"passHostHeader": true,
|
121
|
+
"routes": {
|
122
|
+
"test_1": {
|
123
|
+
"rule": "Host:api.et.127.0.0.1.nip.io"
|
124
|
+
}
|
125
|
+
}
|
126
|
+
},
|
127
|
+
"atos_api": {
|
128
|
+
"entryPoints": [
|
129
|
+
"http"
|
130
|
+
],
|
131
|
+
"backend": "atos_api",
|
132
|
+
"passHostHeader": true,
|
133
|
+
"routes": {
|
134
|
+
"test_1": {
|
135
|
+
"rule": "Host:atos.et.127.0.0.1.nip.io"
|
136
|
+
}
|
137
|
+
}
|
138
|
+
},
|
139
|
+
"s3": {
|
140
|
+
"entryPoints": [
|
141
|
+
"http"
|
142
|
+
],
|
143
|
+
"backend": "s3",
|
144
|
+
"passHostHeader": true,
|
145
|
+
"routes": {
|
146
|
+
"test_1": {
|
147
|
+
"rule": "Host:s3.et.127.0.0.1.nip.io"
|
148
|
+
}
|
149
|
+
}
|
150
|
+
},
|
151
|
+
"mail": {
|
152
|
+
"entryPoints": [
|
153
|
+
"http"
|
154
|
+
],
|
155
|
+
"backend": "mail",
|
156
|
+
"passHostHeader": true,
|
157
|
+
"routes": {
|
158
|
+
"test_1": {
|
159
|
+
"rule": "Host:mail.et.127.0.0.1.nip.io"
|
160
|
+
}
|
161
|
+
}
|
162
|
+
},
|
163
|
+
"azure_blob": {
|
164
|
+
"entryPoints": [
|
165
|
+
"http"
|
166
|
+
],
|
167
|
+
"backend": "azure_blob",
|
168
|
+
"passHostHeader": true,
|
169
|
+
"routes": {
|
170
|
+
"test_1": {
|
171
|
+
"rule": "Host:azure_blob_storage.et.127.0.0.1.nip.io"
|
172
|
+
}
|
173
|
+
}
|
174
|
+
},
|
175
|
+
"fake_acas": {
|
176
|
+
"entryPoints": [
|
177
|
+
"http"
|
178
|
+
],
|
179
|
+
"backend": "fake_acas",
|
180
|
+
"passHostHeader": true,
|
181
|
+
"routes": {
|
182
|
+
"test_1": {
|
183
|
+
"rule": "Host:acas.et.127.0.0.1.nip.io"
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
[file]
|
2
|
+
|
3
|
+
[entryPoints]
|
4
|
+
[entryPoints.http]
|
5
|
+
address = ":3100"
|
6
|
+
[entryPoints.traefik]
|
7
|
+
address = ":3200"
|
8
|
+
|
9
|
+
# API definition
|
10
|
+
# Warning: Enabling API will expose Traefik's configuration.
|
11
|
+
# It is not recommended in production,
|
12
|
+
# unless secured by authentication and authorizations
|
13
|
+
[api]
|
14
|
+
# Name of the related entry point
|
15
|
+
#
|
16
|
+
# Optional
|
17
|
+
# Default: "traefik"
|
18
|
+
#
|
19
|
+
entryPoint = "traefik"
|
20
|
+
|
21
|
+
# Enable Dashboard
|
22
|
+
#
|
23
|
+
# Optional
|
24
|
+
# Default: true
|
25
|
+
#
|
26
|
+
dashboard = true
|
27
|
+
|
28
|
+
# Enable debug mode.
|
29
|
+
# This will install HTTP handlers to expose Go expvars under /debug/vars and
|
30
|
+
# pprof profiling data under /debug/pprof/.
|
31
|
+
# Additionally, the log level will be set to DEBUG.
|
32
|
+
#
|
33
|
+
# Optional
|
34
|
+
# Default: false
|
35
|
+
#
|
36
|
+
debug = true
|
37
|
+
|
38
|
+
[rest]
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
module EtFullSystem
|
3
|
+
#!/usr/bin/env ruby
|
4
|
+
# frozen_string_literal: true
|
5
|
+
module Cli
|
6
|
+
module Docker
|
7
|
+
class ServerCommand < Thor
|
8
|
+
BEFORE_BOOT_SCRIPT =
|
9
|
+
desc "up", "Starts the full system server on docker"
|
10
|
+
def up(*args)
|
11
|
+
Bundler.with_original_env do
|
12
|
+
gem_root = File.absolute_path('../../../..', __dir__)
|
13
|
+
cmd = "docker-compose -f #{gem_root}/docker/docker-compose.yml up #{args.join(' ')}"
|
14
|
+
puts cmd
|
15
|
+
exec(cmd)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "down", "Stops the full system server on docker"
|
20
|
+
def down(*args)
|
21
|
+
::Bundler.with_original_env do
|
22
|
+
gem_root = File.absolute_path('../../../..', __dir__)
|
23
|
+
cmd = "docker-compose -f #{gem_root}/docker/docker-compose.yml down #{args.join(' ')}"
|
24
|
+
puts cmd
|
25
|
+
exec(cmd)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
default_task :up
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative './docker/server'
|
2
|
+
module EtFullSystem
|
3
|
+
#!/usr/bin/env ruby
|
4
|
+
# frozen_string_literal: true
|
5
|
+
class DockerCommand < Thor
|
6
|
+
desc "server", "Starts the full system server on docker or can handle other commands too"
|
7
|
+
subcommand "server", ::EtFullSystem::Cli::Docker::ServerCommand
|
8
|
+
|
9
|
+
desc "bootstrap", "Used by the docker-compose file (using sudo) - do not use yourself"
|
10
|
+
def bootstrap
|
11
|
+
Bundler.with_original_env do
|
12
|
+
cmd = File.absolute_path('../../../shell_scripts/docker_bootstrap.sh', __dir__)
|
13
|
+
puts cmd
|
14
|
+
exec(cmd)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "setup", "Sets up the system for initial run - or after changing branches, adding gems etc.. in any of the services"
|
19
|
+
def setup
|
20
|
+
Bundler.with_original_env do
|
21
|
+
gem_root = File.absolute_path('../../..', __dir__)
|
22
|
+
cmd = "/bin/bash --login -c \"cd /home/app/full_system && et_full_system docker bootstrap && et_full_system local setup\""
|
23
|
+
compose_cmd = "docker-compose -f #{gem_root}/docker/docker-compose.yml run --rm et #{cmd}"
|
24
|
+
puts compose_cmd
|
25
|
+
exec(compose_cmd)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "compose", "Provides access to the docker-compose command"
|
30
|
+
def compose(*args)
|
31
|
+
Bundler.with_original_env do
|
32
|
+
gem_root = File.absolute_path('../../..', __dir__)
|
33
|
+
cmd = "docker-compose -f #{gem_root}/docker/docker-compose.yml #{args.join(' ')}"
|
34
|
+
puts cmd
|
35
|
+
exec(cmd)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "reset", "Bring down the server, remove all caches, rebuild the Dockerfile etc..."
|
40
|
+
def reset
|
41
|
+
Bundler.with_original_env do
|
42
|
+
gem_root = File.absolute_path('../../..', __dir__)
|
43
|
+
cmd = "docker-compose -f #{gem_root}/docker/docker-compose.yml down -v"
|
44
|
+
puts cmd
|
45
|
+
next unless system(cmd)
|
46
|
+
cmd = "docker-compose -f #{gem_root}/docker/docker-compose.yml build --no-cache"
|
47
|
+
puts cmd
|
48
|
+
next unless system(cmd)
|
49
|
+
self.class.start(['setup'])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "update_service_url SERVICE URL", "Configures the reverse proxy to connect to a specific url for a service - note the URL must be reachable from the docker container and the server must be running"
|
54
|
+
def update_service_url(service, url)
|
55
|
+
Bundler.with_original_env do
|
56
|
+
gem_root = File.absolute_path('../../..', __dir__)
|
57
|
+
cmd = "/bin/bash --login -c \"et_full_system update_service_url #{service} #{url}\""
|
58
|
+
compose_cmd = "docker-compose -f #{gem_root}/docker/docker-compose.yml exec et #{cmd}"
|
59
|
+
puts compose_cmd
|
60
|
+
exec(compose_cmd)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module EtFullSystem
|
2
|
+
#!/usr/bin/env ruby
|
3
|
+
# frozen_string_literal: true
|
4
|
+
require "rubygems"
|
5
|
+
require "thor"
|
6
|
+
require 'aws-sdk-s3'
|
7
|
+
require 'azure/storage'
|
8
|
+
|
9
|
+
module Cli
|
10
|
+
module Local
|
11
|
+
class FileStorageCommand < Thor
|
12
|
+
GEM_PATH = File.absolute_path('../../../..', __dir__)
|
13
|
+
|
14
|
+
desc "setup", "Primes the storage account(s) for running locally - i.e. using local S3 or Azure Blob storage"
|
15
|
+
def setup_storage
|
16
|
+
setup_s3_storage
|
17
|
+
setup_azure_storage
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def setup_s3_storage
|
23
|
+
config = {
|
24
|
+
region: ENV.fetch('AWS_REGION', 'us-east-1'),
|
25
|
+
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID', 'accessKey1'),
|
26
|
+
secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY', 'verySecretKey1'),
|
27
|
+
endpoint: ENV.fetch('AWS_ENDPOINT', 'http://s3.et.127.0.0.1.nip.io:3100/'),
|
28
|
+
force_path_style: ENV.fetch('AWS_S3_FORCE_PATH_STYLE', 'true') == 'true'
|
29
|
+
}
|
30
|
+
s3 = Aws::S3::Client.new(config)
|
31
|
+
retry_countdown = 10
|
32
|
+
begin
|
33
|
+
Aws::S3::Bucket.new(client: s3, name: 'et1bucket').tap do |bucket|
|
34
|
+
bucket.create unless bucket.exists?
|
35
|
+
end
|
36
|
+
Aws::S3::Bucket.new(client: s3, name: 'etapibucket').tap do |bucket|
|
37
|
+
bucket.create unless bucket.exists?
|
38
|
+
end
|
39
|
+
rescue Seahorse::Client::NetworkingError, Aws::S3::Errors::NotFound, Aws::S3::Errors::Http502Error, Aws::Errors::ServiceError
|
40
|
+
retry_countdown -= 1
|
41
|
+
if retry_countdown.zero?
|
42
|
+
fail "Could not connect to the S3 server after 10 retries"
|
43
|
+
else
|
44
|
+
STDERR.puts "Retrying connection to S3 server in 30 seconds"
|
45
|
+
sleep 30
|
46
|
+
retry
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def setup_azure_storage
|
52
|
+
Bundler.with_original_env do
|
53
|
+
puts `bash --login -c "cd systems/api && rvm use && dotenv -f \"#{GEM_PATH}/foreman/.env\" dotenv -f \"#{GEM_PATH}/foreman/et_api.env\" bundle exec bundle exec rails configure_azure_storage_containers configure_azure_storage_cors"`
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|