wovnrb 3.3.1 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -0
  3. data/README.en.md +30 -13
  4. data/Rakefile +0 -1
  5. data/build.sh +7 -0
  6. data/docker/nginx/Dockerfile +18 -0
  7. data/docker/nginx/README.md +13 -0
  8. data/docker/nginx/build.sh +8 -0
  9. data/docker/nginx/scripts/configure_sshd.sh +25 -0
  10. data/docker/nginx/scripts/startup.sh +10 -0
  11. data/docker/nginx/wovnrb.conf +19 -0
  12. data/docker/rails/Dockerfile +9 -0
  13. data/docker/rails/Dockerfile.ECS +17 -0
  14. data/docker/rails/TestSite/Gemfile +0 -2
  15. data/docker/rails/TestSite/app/controllers/custom_response_controller.rb +1 -1
  16. data/docker/rails/TestSite/config/environments/development.rb +2 -0
  17. data/docker/rails/TestSite/config/environments/production.rb +2 -0
  18. data/docker/rails/TestSite/config/environments/test.rb +2 -0
  19. data/docker/rails/TestSite/public/index.html +1 -1
  20. data/docker/rails/TestSite/start.sh +2 -12
  21. data/docker/rails/TestSite/start_rails.sh +9 -0
  22. data/docker/rails/TestSite/yarn.lock +6 -6
  23. data/docker/scripts/jenkins/build.sh +45 -0
  24. data/docker/scripts/jenkins/tag_and_push_image.sh +30 -0
  25. data/docker/scripts/jenkins/taskdef.json +104 -0
  26. data/docker/scripts/jenkins/taskdef.json.bak +99 -0
  27. data/lib/wovnrb/api_translator.rb +19 -19
  28. data/lib/wovnrb/headers.rb +23 -6
  29. data/lib/wovnrb/helpers/nokogumbo_helper.rb +1 -1
  30. data/lib/wovnrb/lang.rb +3 -3
  31. data/lib/wovnrb/services/html_converter.rb +21 -1
  32. data/lib/wovnrb/services/url.rb +136 -0
  33. data/lib/wovnrb/store.rb +9 -3
  34. data/lib/wovnrb/url_language_switcher.rb +124 -0
  35. data/lib/wovnrb/version.rb +1 -1
  36. data/lib/wovnrb.rb +6 -4
  37. data/test/lib/api_translator_test.rb +66 -19
  38. data/test/lib/services/html_converter_test.rb +212 -39
  39. data/test/lib/services/url_test.rb +308 -0
  40. data/test/lib/url_language_switcher_test.rb +798 -0
  41. data/test/lib/wovnrb_test.rb +2 -1
  42. data/test/test_helper.rb +5 -2
  43. data/wovnrb.gemspec +3 -2
  44. metadata +42 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5c458ea4be1b5bc1325a0c54a9672f7fd744b864975699ae48e70acde6d5265
4
- data.tar.gz: 318102aa29ae9bbb03d5cf0b1ccffa3f39ada7a8fc963daad856b058f46e46ec
3
+ metadata.gz: 29bd88528d91b54ec9a05a04618c94466ecc514b32964c6a771a4a8b3f2e5578
4
+ data.tar.gz: aa3c23a353b77ccb3abc93036e88b42f4794d1ea983af8b6b36a0287f2665c6a
5
5
  SHA512:
6
- metadata.gz: fd81bc766461ce8212a32afafc0a673790985213304c55765322e42591e34107a649d70e1133a597b88c6cda3ee0813cd1b4efbac1ff45d2d794f52d78c80814
7
- data.tar.gz: fd4304143e2226ab1b9a887d45e2326da8b8b452e0a60bcbb94f3b680fc4280459e47fb3b025d6660c2d338a1d3150617fc279b279e68693b0566a41050bd3de
6
+ metadata.gz: 391f38b423bc709f052a33515452a04202c507060d7fb24fe202d3eb7788fb646a114b5258065f896bbd540d4e3187ccc29510f1b6b0744ceea45f6372e8b533
7
+ data.tar.gz: 43175960da9790a1ced786d357469f2c590b530add67b4e8a938deacbf9be45b70f917c1ef26279432e6dbb9ad7b99cc889aa07ebe5ece177e7c30bc1677727f
data/.rubocop.yml CHANGED
@@ -1 +1,6 @@
1
+ require: rubocop-performance
2
+
1
3
  inherit_from: .rubocop_todo.yml
4
+
5
+ AllCops:
6
+ SuggestExtensions: false
data/README.en.md CHANGED
@@ -74,19 +74,22 @@ After completing setup, start the Ruby Application, and make sure the WOVN.io li
74
74
 
75
75
  The following is a list of the WOVN.io Ruby Library's valid parameters.
76
76
 
77
- Parameter Name | Required | Default Setting
78
- ----------------------| -------- | ----------------
79
- project_token | yes | ''
80
- default_lang | yes | 'ja'
81
- supported_langs | yes | ['ja', 'en']
82
- url_pattern | yes | 'path'
83
- lang_param_name | | 'wovn'
84
- query | | []
85
- ignore_class | | []
86
- translate_fragment | | true
87
- ignore_paths | | []
88
- install_middleware | | true
89
- compress_api_requests | | true
77
+ Parameter Name | Required | Default Setting
78
+ -------------------------------| -------- | ----------------
79
+ project_token | yes | ''
80
+ default_lang | yes | 'ja'
81
+ supported_langs | yes | ['ja', 'en']
82
+ url_pattern | yes | 'path'
83
+ lang_param_name | | 'wovn'
84
+ query | | []
85
+ ignore_class | | []
86
+ translate_fragment | | true
87
+ ignore_paths | | []
88
+ install_middleware | | true
89
+ compress_api_requests | | true
90
+ api_timeout_seconds | | 1.0
91
+ api_timeout_search_engine_bots | | 5.0
92
+ translate_canonical_tag | | true
90
93
 
91
94
  ### 2.1. project_token
92
95
 
@@ -201,3 +204,17 @@ WOVN.rb needs to be added after any compression middleware.
201
204
  ### 2.11 compress_api_requests
202
205
 
203
206
  By default, requests to the translation API will be sent with gzip compression. Set to false to disable compression.
207
+
208
+ ### 2.12 api_timeout_seconds
209
+ Configures the amount of time in seconds wovnrb will wait for the translation API for a response before the
210
+ request is considered timed-out. This setting defaults to `1.0`.
211
+
212
+ ### 2.13 api_timeout_search_engine_bots
213
+ Similar to `api_timeout_seconds`, this timeout setting is applied when handling requests made by search engine bots.
214
+ Currently, bots from Google, Yahoo, Bing, Yandex, DuckDuckGo and Baidu are supported. This setting
215
+ defaults to `5.0`.
216
+
217
+ ### 2.14 translate_canonical_tag
218
+ Configures if wovnrb should automatically translate existing canonical tag in the HTML. When set to `true`, wovnrb
219
+ will translate the canonical URL with the current language code according to your `url_pattern` setting.
220
+ This setting defaults to `true`.
data/Rakefile CHANGED
@@ -6,7 +6,6 @@ require 'pry'
6
6
  Rake::TestTask.new do |t|
7
7
  t.libs << 'test'
8
8
  t.test_files = FileList['test/**/*.rb']
9
- t.options = '-p'
10
9
  end
11
10
 
12
11
  task :package do
data/build.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+ set -eux
3
+
4
+ TAG=$1
5
+ cd $(dirname $0)
6
+ docker build -t "${TAG}" -f docker/rails/Dockerfile.ECS .
7
+ cd -
@@ -0,0 +1,18 @@
1
+ FROM nginx:stable
2
+
3
+ WORKDIR /var/tmp/nginx
4
+
5
+ ADD wovnrb.conf .
6
+ ADD scripts/startup.sh .
7
+ ADD scripts/configure_sshd.sh .
8
+
9
+ RUN apt-get update --allow-releaseinfo-change \
10
+ && apt install --no-install-recommends -y \
11
+ vim \
12
+ && apt-get clean \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Setup sshd
16
+ RUN ./configure_sshd.sh
17
+
18
+ CMD ["/var/tmp/nginx/startup.sh"]
@@ -0,0 +1,13 @@
1
+ Update `nginx/{ENV_ID}/config`.
2
+ And build new image.
3
+
4
+
5
+ ## How to Build
6
+
7
+ *Notice*
8
+ You need aws credentials `wovn-code-pipeline` for building image.
9
+ If you need it, please contact to Infrastructure Team.
10
+
11
+ ```
12
+ ./build.sh
13
+ ```
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ set -eux
3
+
4
+ TAG="${1}"
5
+ cd $(dirname $0)
6
+ docker build -t ${TAG} .
7
+
8
+ cd -
@@ -0,0 +1,25 @@
1
+ #!/bin/bash
2
+ set -eu
3
+
4
+ # Install openssh-server
5
+ apt-get update --allow-releaseinfo-change \
6
+ && apt install --no-install-recommends -y \
7
+ openssh-server \
8
+ && apt-get clean \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Update sshd_config
12
+ echo -e "Port 22\n" >> /etc/ssh/sshd_config
13
+ echo -e "AllowUsers ec2-user\n" >> /etc/ssh/sshd_config
14
+ echo -e "AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 /etc/authorized_keys/%u\n" >> /etc/ssh/sshd_config
15
+ mkdir /etc/authorized_keys
16
+
17
+ # Setup user and authorized_keys
18
+ useradd -m -d /home/ec2-user -s /bin/bash ec2-user
19
+ echo "ec2-user:$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1)" | chpasswd
20
+ echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCp1wkFbEfS2CuUwSMJy5zx3SenZF6WOL0o60ngHYJ0bHWEe7e7KCdwkyKkgF8A57in2faI+nKO0ScnAYcuwEy5BJNh6789TEdNtC4mpKr7A5x0MEkAdWyjjQu/upsaDASSEmJO8dFV/xu/IEUticxA960Rz2ncOPRHFubnbFkCOUg2vy8dfZybx1d9bZWEdDrcnPFjhhxeti+Cq/OdwtTlteffUKhi7qcDKHZEGi3zHzrvXiSwKJHgyMdUNf/PzIV+9Z0G0XwrnZ/q6WQNESNaEra7Iwvl921hzlxP8RKDCaxsryAHR67BCJjqhok7qtnujQYWMNc40z1ewC0o+oat" > /etc/authorized_keys/ec2-user
21
+
22
+ # Add ec2-user to wheel group
23
+ groupadd -g 999 wheel
24
+ sed -i -e 's/wheel:x:999:/wheel:x:999:root,ec2-user/g' /etc/group
25
+ sed -i -e 's/^# auth required pam_wheel.so/auth sufficient pam_wheel.so trust/g' /etc/pam.d/su
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Add port for sshd
5
+ echo "Port 40022" >> /etc/ssh/sshd_config
6
+ service ssh restart
7
+
8
+ cp -a /var/tmp/nginx/wovnrb.conf /etc/nginx/conf.d/
9
+
10
+ nginx -g 'daemon off;'
@@ -0,0 +1,19 @@
1
+ map $http_user_agent $check_ua {
2
+ ~ELB-HealthChecker/ 0;
3
+ default 1;
4
+ }
5
+
6
+ server {
7
+ listen 80 default_server;
8
+ server_name wovn.io;
9
+
10
+ location / {
11
+ proxy_pass http://localhost:4000;
12
+ proxy_http_version 1.1;
13
+ proxy_set_header Upgrade $http_upgrade;
14
+ proxy_set_header Connection 'upgrade';
15
+ proxy_set_header Host $host;
16
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
17
+ proxy_cache_bypass $http_upgrade;
18
+ }
19
+ }
@@ -3,4 +3,13 @@ FROM ruby:2.6.5
3
3
  WORKDIR /usr/src/app
4
4
 
5
5
  COPY ./TestSite/ .
6
+
7
+ RUN gem update --system
8
+ RUN gem uninstall bundler && rm /usr/local/bin/bundle && rm /usr/local/bin/bundler
9
+ RUN gem install bundler:2.1.4
10
+ RUN apt update && apt install npm -y
11
+ RUN npm install --global yarn
12
+ RUN yarn install --check-files
13
+ RUN bundle install
14
+
6
15
  CMD ["/bin/bash", "start.sh"]
@@ -0,0 +1,17 @@
1
+ FROM ruby:2.6.5
2
+
3
+ WORKDIR /usr/src/app
4
+
5
+ COPY docker/rails/TestSite .
6
+ COPY lib ./wovnrb/lib
7
+ COPY Gemfile ./wovnrb/
8
+ COPY wovnrb.gemspec ./wovnrb/
9
+
10
+ RUN gem update --system && gem uninstall bundler && \
11
+ rm /usr/local/bin/bundle && rm /usr/local/bin/bundler
12
+ RUN gem install bundler:2.1.4 && bundle install
13
+ RUN apt update -y && apt install npm -y && apt-get install openssh-server -y && apt-get install vim -y
14
+ RUN npm install --global yarn
15
+ RUN yarn install --check-files
16
+
17
+ CMD ["/bin/bash", "start_rails.sh"]
@@ -52,5 +52,3 @@ end
52
52
 
53
53
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
54
54
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
55
-
56
- gem 'wovnrb', path: './wovnrb'
@@ -1,5 +1,5 @@
1
1
  class CustomResponseController < ApplicationController
2
- skip_before_action :verify_authenticity_token2
2
+ skip_before_action :verify_authenticity_token
3
3
 
4
4
  def make_response
5
5
  response_args_json = params[:response]
@@ -59,4 +59,6 @@ Rails.application.configure do
59
59
  # Use an evented file watcher to asynchronously detect changes in source code,
60
60
  # routes, locales, etc. This feature depends on the listen gem.
61
61
  config.file_watcher = ActiveSupport::EventedFileUpdateChecker
62
+
63
+ config.hosts << "example.com"
62
64
  end
@@ -109,4 +109,6 @@ Rails.application.configure do
109
109
  # config.active_record.database_selector = { delay: 2.seconds }
110
110
  # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
111
111
  # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
112
+
113
+ config.hosts << "example.com"
112
114
  end
@@ -46,4 +46,6 @@ Rails.application.configure do
46
46
 
47
47
  # Raises error for missing translations.
48
48
  # config.action_view.raise_on_missing_translations = true
49
+
50
+ config.hosts << "example.com"
49
51
  end
@@ -4,6 +4,6 @@
4
4
  <title>test</title>
5
5
  </head>
6
6
  <body>
7
- <h1>Hello WOVN.php world!</h1>
7
+ <h1>Hello WOVN.rb world!</h1>
8
8
  </body>
9
9
  </html>
@@ -1,14 +1,4 @@
1
- cd /usr/src/app
2
- gem update --system
3
- gem uninstall bundler
4
- rm /usr/local/bin/bundle
5
- rm /usr/local/bin/bundler
6
- gem install bundler:2.1.4
7
- update --bundler
8
- bundle update
1
+ # ./wovnrb should not be cached
2
+ echo "gem 'wovnrb', path: './wovnrb'" >> Gemfile
9
3
  bundle install
10
- apt update
11
- apt install npm -y
12
- npm install --global yarn
13
- yarn install --check-files
14
4
  bin/rails server -b 0.0.0.0 -e development -p 4000
@@ -0,0 +1,9 @@
1
+ mkdir /root/.ssh
2
+ touch /root/.ssh/authorized_keys
3
+ echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCp1wkFbEfS2CuUwSMJy5zx3SenZF6WOL0o60ngHYJ0bHWEe7e7KCdwkyKkgF8A57in2faI+nKO0ScnAYcuwEy5BJNh6789TEdNtC4mpKr7A5x0MEkAdWyjjQu/upsaDASSEmJO8dFV/xu/IEUticxA960Rz2ncOPRHFubnbFkCOUg2vy8dfZybx1d9bZWEdDrcnPFjhhxeti+Cq/OdwtTlteffUKhi7qcDKHZEGi3zHzrvXiSwKJHgyMdUNf/PzIV+9Z0G0XwrnZ/q6WQNESNaEra7Iwvl921hzlxP8RKDCaxsryAHR67BCJjqhok7qtnujQYWMNc40z1ewC0o+oat" > /root/.ssh/authorized_keys
4
+ echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8M0XAzp2KYW6pA4dmoRmC5jpfGqotxMTUXuUVTyCBc" >> /root/.ssh/authorized_keys
5
+ echo "AuthorizedKeysFile .ssh/authorized_keys" >> /etc/ssh/sshd_config
6
+ echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
7
+ echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
8
+ service ssh start
9
+ bin/rails server -b 0.0.0.0 -e development -p 4000
@@ -3094,9 +3094,9 @@ flush-write-stream@^1.0.0:
3094
3094
  readable-stream "^2.3.6"
3095
3095
 
3096
3096
  follow-redirects@^1.0.0:
3097
- version "1.14.0"
3098
- resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.0.tgz#f5d260f95c5f8c105894491feee5dc8993b402fe"
3099
- integrity sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg==
3097
+ version "1.14.7"
3098
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685"
3099
+ integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==
3100
3100
 
3101
3101
  for-in@^1.0.2:
3102
3102
  version "1.0.2"
@@ -5129,9 +5129,9 @@ path-key@^2.0.0, path-key@^2.0.1:
5129
5129
  integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
5130
5130
 
5131
5131
  path-parse@^1.0.6:
5132
- version "1.0.6"
5133
- resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
5134
- integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
5132
+ version "1.0.7"
5133
+ resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
5134
+ integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
5135
5135
 
5136
5136
  path-to-regexp@0.1.7:
5137
5137
  version "0.1.7"
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env bash
2
+ set -eux
3
+ export AWS_PROFILE="wovn-code-staging-pipeline"
4
+ export AWS_REGION="us-west-2"
5
+ export ECR_HOST="257024234524.dkr.ecr.us-west-2.amazonaws.com"
6
+ REPO_NAME_WOVNRB="wovnrb"
7
+ REPO_NAME_NGINX="wovnrb-nginx"
8
+ CLUSTER_NAME="wovn-library-testing"
9
+ TASKDEF_FAMILY_NAME="wovnrb"
10
+ ECS_SERVICE_NAME="wovnrb"
11
+ PROJECT_DIR=$(dirname "$0")/../../..
12
+
13
+ commit_hash=$(git rev-parse --short HEAD)
14
+ image_tag="${commit_hash}"
15
+
16
+ sh ${PROJECT_DIR}/build.sh "${REPO_NAME_WOVNRB}":"${image_tag}"
17
+ sh ${PROJECT_DIR}/docker/nginx/build.sh "${REPO_NAME_NGINX}":"${image_tag}"
18
+
19
+ source ${PROJECT_DIR}/docker/scripts/jenkins/tag_and_push_image.sh
20
+
21
+ set +x
22
+ $(aws ecr get-login --no-include-email --region "${AWS_REGION}" --profile "${AWS_PROFILE}")
23
+ set -x
24
+
25
+ tag_and_push_image "${AWS_REGION}" "${REPO_NAME_WOVNRB}" "${image_tag}" "staging"
26
+ tag_and_push_image "${AWS_REGION}" "${REPO_NAME_NGINX}" "${image_tag}" "staging"
27
+
28
+ sed -i "s#wovnrb:latest#"${REPO_NAME_WOVNRB}":"${image_tag}"#g" ${PROJECT_DIR}/docker/scripts/jenkins/taskdef.json
29
+ sed -i "s#wovnrb-nginx:latest#"${REPO_NAME_NGINX}":"${image_tag}"#g" ${PROJECT_DIR}/docker/scripts/jenkins/taskdef.json
30
+
31
+ cd ${PROJECT_DIR}/docker/scripts/jenkins/
32
+ TASKDEF_REVISION=$(aws ecs register-task-definition \
33
+ --profile "${AWS_PROFILE}" --region "${AWS_REGION}" \
34
+ --cli-input-json file://$(pwd)/taskdef.json \
35
+ | jq ."taskDefinition.revision")
36
+ echo "${TASKDEF_REVISION}"
37
+
38
+ echo "Start ECS Rolling deploy. Update ${ECS_SERVICE_NAME} by ${TASKDEF_FAMILY_NAME}:${TASKDEF_REVISION}"
39
+ aws ecs update-service \
40
+ --profile "${AWS_PROFILE}" --region "${AWS_REGION}" \
41
+ --cluster "${CLUSTER_NAME}" \
42
+ --service "${ECS_SERVICE_NAME}" \
43
+ --task-definition "${TASKDEF_FAMILY_NAME}:${TASKDEF_REVISION}"
44
+
45
+ cd -
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Tag to docker image and push it to specified ECR
4
+ #
5
+ # Required environment variables:
6
+ # - AWS_PROFILE (AWS profile authorized for ECR login and S3 release)
7
+ #
8
+ # Args:
9
+ # - region: ECR region (e.g. us-west-1 | us-west-2 )
10
+ # - image-name: docker image name (e.g. equalizer-nginx)
11
+ # - tag: docker image tag. we use git commit hash ordinary (git rev-parse --short HEAD)
12
+
13
+ tag_and_push_image() {
14
+ local aws_region="${1}"
15
+ local image_name="${2}"
16
+ local tag="${3}"
17
+ local account="${4}"
18
+
19
+ if [ ${account} == "production" ]; then
20
+ local ecr_host="140249473629.dkr.ecr.${aws_region}.amazonaws.com"
21
+ elif [ ${account} == "staging" ]; then
22
+ local ecr_host="257024234524.dkr.ecr.${aws_region}.amazonaws.com"
23
+ else
24
+ echo "Passed account not recognized"
25
+ local ecr_host=""
26
+ fi
27
+
28
+ docker tag ${image_name}:${tag} ${ecr_host}/${image_name}:${tag}
29
+ docker push ${ecr_host}/${image_name}:${tag}
30
+ }
@@ -0,0 +1,104 @@
1
+ {
2
+ "executionRoleArn": "arn:aws:iam::257024234524:role/ecsTaskExecutionRole",
3
+ "containerDefinitions": [
4
+ {
5
+ "name": "wovnrb-nginx",
6
+ "cpu": 0,
7
+ "image": "257024234524.dkr.ecr.us-west-2.amazonaws.com/wovnrb-nginx:latest",
8
+ "mountPoints": [],
9
+ "ulimits": [
10
+ {
11
+ "name": "nofile",
12
+ "softLimit": 65535,
13
+ "hardLimit": 65535
14
+ }
15
+ ],
16
+ "logConfiguration": {
17
+ "logDriver": "awslogs",
18
+ "options": {
19
+ "awslogs-group": "/ecs/wovnrb",
20
+ "awslogs-region": "us-west-2",
21
+ "awslogs-stream-prefix": "ecs"
22
+ }
23
+ },
24
+ "essential": true,
25
+ "portMappings": [
26
+ {
27
+ "hostPort": 80,
28
+ "protocol": "tcp",
29
+ "containerPort": 80
30
+ },
31
+ {
32
+ "hostPort": 40022,
33
+ "protocol": "tcp",
34
+ "containerPort": 40022
35
+ }
36
+ ],
37
+ "stopTimeout": 120,
38
+ "dependsOn": [
39
+ {
40
+ "containerName": "wovnrb",
41
+ "condition": "HEALTHY"
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "wovnrb",
47
+ "cpu": 0,
48
+ "image": "257024234524.dkr.ecr.us-west-2.amazonaws.com/wovnrb:latest",
49
+ "mountPoints": [],
50
+ "workingDirectory": "/usr/src/app",
51
+ "linuxParameters": {
52
+ "initProcessEnabled": true
53
+ },
54
+ "environment": [],
55
+ "ulimits": [
56
+ {
57
+ "name": "nofile",
58
+ "softLimit": 65535,
59
+ "hardLimit": 65535
60
+ }
61
+ ],
62
+ "logConfiguration": {
63
+ "logDriver": "awslogs",
64
+ "options": {
65
+ "awslogs-group": "/ecs/wovnrb",
66
+ "awslogs-region": "us-west-2",
67
+ "awslogs-stream-prefix": "ecs"
68
+ }
69
+ },
70
+ "portMappings": [
71
+ {
72
+ "hostPort": 4000,
73
+ "protocol": "tcp",
74
+ "containerPort": 4000
75
+ },
76
+ {
77
+ "hostPort": 22,
78
+ "protocol": "tcp",
79
+ "containerPort": 22
80
+ }
81
+ ],
82
+ "volumesFrom": [],
83
+ "stopTimeout": 120,
84
+ "healthCheck": {
85
+ "retries": 3,
86
+ "command": [
87
+ "CMD-SHELL",
88
+ "curl -f http://localhost:4000/ || exit 1"
89
+ ],
90
+ "timeout": 20,
91
+ "interval": 60,
92
+ "startPeriod": 180
93
+ },
94
+ "essential": true
95
+ }
96
+ ],
97
+ "placementConstraints": [],
98
+ "cpu": "1024",
99
+ "memory": "2048",
100
+ "requiresCompatibilities": [ "FARGATE" ],
101
+ "family": "wovnrb",
102
+ "networkMode": "awsvpc",
103
+ "volumes": []
104
+ }
@@ -0,0 +1,99 @@
1
+ {
2
+ "executionRoleArn": "arn:aws:iam::257024234524:role/ecsTaskExecutionRole",
3
+ "containerDefinitions": [
4
+ {
5
+ "name": "wovnrb-nginx",
6
+ "cpu": 0,
7
+ "image": "257024234524.dkr.ecr.us-west-2.amazonaws.com/wovnrb-nginx:latest",
8
+ "mountPoints": [],
9
+ "ulimits": [
10
+ {
11
+ "name": "nofile",
12
+ "softLimit": 65535,
13
+ "hardLimit": 65535
14
+ }
15
+ ],
16
+ "logConfiguration": {
17
+ "logDriver": "awslogs",
18
+ "options": {
19
+ "awslogs-group": "/ecs/wovnrb",
20
+ "awslogs-region": "us-west-2",
21
+ "awslogs-stream-prefix": "ecs"
22
+ }
23
+ },
24
+ "essential": true,
25
+ "portMappings": [
26
+ {
27
+ "hostPort": 80,
28
+ "protocol": "tcp",
29
+ "containerPort": 80
30
+ },
31
+ {
32
+ "hostPort": 40022,
33
+ "protocol": "tcp",
34
+ "containerPort": 40022
35
+ }
36
+ ],
37
+ "stopTimeout": 120,
38
+ "dependsOn": [
39
+ {
40
+ "containerName": "wovnrb",
41
+ "condition": "HEALTHY"
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "wovnrb",
47
+ "cpu": 0,
48
+ "image": "257024234524.dkr.ecr.us-west-2.amazonaws.com/wovnrb:36d9648",
49
+ "mountPoints": [],
50
+ "workingDirectory": "/usr/src/app",
51
+ "linuxParameters": {
52
+ "initProcessEnabled": true
53
+ },
54
+ "environment": [],
55
+ "ulimits": [
56
+ {
57
+ "name": "nofile",
58
+ "softLimit": 65535,
59
+ "hardLimit": 65535
60
+ }
61
+ ],
62
+ "logConfiguration": {
63
+ "logDriver": "awslogs",
64
+ "options": {
65
+ "awslogs-group": "/ecs/wovnrb",
66
+ "awslogs-region": "us-west-2",
67
+ "awslogs-stream-prefix": "ecs"
68
+ }
69
+ },
70
+ "portMappings": [
71
+ {
72
+ "hostPort": 4000,
73
+ "protocol": "tcp",
74
+ "containerPort": 4000
75
+ }
76
+ ],
77
+ "volumesFrom": [],
78
+ "stopTimeout": 120,
79
+ "healthCheck": {
80
+ "retries": 3,
81
+ "command": [
82
+ "CMD-SHELL",
83
+ "curl -f http://localhost:4000/ || exit 1"
84
+ ],
85
+ "timeout": 20,
86
+ "interval": 60,
87
+ "startPeriod": 180
88
+ },
89
+ "essential": true
90
+ }
91
+ ],
92
+ "placementConstraints": [],
93
+ "cpu": "1024",
94
+ "memory": "2048",
95
+ "requiresCompatibilities": [ "FARGATE" ],
96
+ "family": "wovnrb",
97
+ "networkMode": "awsvpc",
98
+ "volumes": []
99
+ }