elastic_beans 0.13.0.alpha6 → 0.13.0.alpha7
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.
- checksums.yaml +4 -4
- data/README.md +16 -13
- data/lib/elastic_beans/configuration_template/base.rb +1 -1
- data/lib/elastic_beans/configuration_template/exec.rb +1 -1
- data/lib/elastic_beans/configuration_template/scheduler.rb +1 -1
- data/lib/elastic_beans/configuration_template/worker.rb +1 -1
- data/lib/elastic_beans/rack/exec.rb +2 -2
- data/lib/elastic_beans/rack/health_check.rb +2 -2
- data/lib/elastic_beans/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c7e6af10b562bf1ca2c47b499c962479c25f260
|
4
|
+
data.tar.gz: cb958914d9f2d97153369addbef09dff743d5d32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16acb819c121eb984ae73eacf7b77ead3ff936b6e66eddaf8e1147e99ecf6cfb16abaf4e09fe402194e2f39e84edb3f146ea91f53667ddabfafb149a5675a22d
|
7
|
+
data.tar.gz: 70655c6345593c2fd1b4efcacd93713205a4556c2fa6e9ef077b9e71a0d5a8a4355beb8faa05f5a2021cd99c52839014e4100589d399ef4ebd29734c62e8ec8f
|
data/README.md
CHANGED
@@ -29,7 +29,8 @@ As the SDK documentation suggests, using environment variables is recommended.
|
|
29
29
|
[-o 'OPTION_SETTING_NAMESPACE/OPTION_NAME=VALUE'...]
|
30
30
|
beans setenv -a myapp \
|
31
31
|
DATABASE_URL=mysql2://db.example.com:3306/myapp \
|
32
|
-
SECRET_KEY_BASE=abc123
|
32
|
+
SECRET_KEY_BASE=abc123 \
|
33
|
+
REDIS_URL=redis://...
|
33
34
|
|
34
35
|
# Create a webserver environment with a pretty DNS name at myapp.TLD (managed by Route53)
|
35
36
|
beans create -a myapp [-d myapp.TLD] [--tags=Environment:production Team:Unicorn] webserver
|
@@ -46,14 +47,11 @@ As the SDK documentation suggests, using environment variables is recommended.
|
|
46
47
|
# Create a periodic task scheduler using cron.yaml
|
47
48
|
beans create -a myapp scheduler
|
48
49
|
|
49
|
-
# Set environment variables across all environments
|
50
|
-
beans setenv -a myapp REDIS_URL=redis://...
|
51
|
-
|
52
50
|
# Create an application version for the HEAD git commit in the working directory.
|
53
51
|
# Then deploy that version to each running environment.
|
54
52
|
beans deploy -a myapp
|
55
53
|
|
56
|
-
# Run one-off tasks
|
54
|
+
# Run one-off tasks in the execution environment created earlier
|
57
55
|
beans exec rake db:migrate -a myapp
|
58
56
|
|
59
57
|
# SSH to an instance for debugging, tunneling through a bastion instance to reach the private network
|
@@ -101,10 +99,21 @@ In `config/initializers/elastic_beans.rb`, add the middleware into your stack, b
|
|
101
99
|
### Periodic tasks
|
102
100
|
|
103
101
|
Elastic Beanstalk [supports periodic tasks][periodic] by sending a POST request to an endpoint of your application.
|
104
|
-
|
102
|
+
Create a periodic scheduler environment to enqueue tasks:
|
103
|
+
|
104
|
+
beans create -a myapp scheduler
|
105
|
+
|
106
|
+
This environment will enqueue the commands from `cron.yaml`.
|
105
107
|
|
106
108
|
[periodic]: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html#worker-periodictasks
|
107
109
|
|
110
|
+
The [active-elastic-job gem](https://github.com/tawan/active-elastic-job#set-up-periodic-tasks-cron-jobs) supports executing background jobs as periodic tasks at a special endpoint.
|
111
|
+
This approach will work fine as long [as your jobs can execute within the time allotted by nginx and SQS](https://medium.com/one-medical-engineering/elastic-beanstalk-one-off-and-periodic-tasks-752bbae841ae#3d23).
|
112
|
+
|
113
|
+
If you need more time, Elastic Beans includes a middleware that can convert specially-crafted paths into commands and enqueue them for execution just like `beans exec`.
|
114
|
+
"Specially-crafted" meaning with /exec at the front, as the cron.yaml section below explains.
|
115
|
+
The middleware only accepts localhost requests from `aws-sqsd`.
|
116
|
+
|
108
117
|
In `config/initializers/elastic_beans.rb`, add the middleware into your stack, below forcing HTTPS (`aws-sqsd` does not use HTTPS):
|
109
118
|
|
110
119
|
require "elastic_beans/rack/exec"
|
@@ -141,12 +150,6 @@ In `cron.yaml`, name the full command to be run and use `/exec` as the `url`:
|
|
141
150
|
- name: rake myapp:mytask[arg1,arg2]
|
142
151
|
url: "/exec"
|
143
152
|
|
144
|
-
Then create a periodic scheduler environment using `cron.yaml`:
|
145
|
-
|
146
|
-
beans create -a myapp scheduler
|
147
|
-
|
148
|
-
This environment will enqueue the commands from `cron.yaml` for the `exec` environment to run.
|
149
|
-
|
150
153
|
## What elastic_beans does differently than awsebcli
|
151
154
|
|
152
155
|
### Cleanup of old versions
|
@@ -256,7 +259,7 @@ Make sure that its redrive policy allows such inspection before considering a me
|
|
256
259
|
### Code
|
257
260
|
|
258
261
|
Your application must use the [active-elastic-job gem](https://github.com/tawan/active-elastic-job) for background job processing.
|
259
|
-
Elastic Beans will set the `
|
262
|
+
Elastic Beans will set the `PROCESS_ACTIVE_ELASTIC_JOBS` environment variable appropriately in your environments.
|
260
263
|
|
261
264
|
### Known issues and limitations of the pre-release
|
262
265
|
|
@@ -51,7 +51,7 @@ module ElasticBeans
|
|
51
51
|
template_option_setting(template: template, namespace: "aws:elasticbeanstalk:command", option_name: "BatchSize", default: "1", new_settings: option_settings),
|
52
52
|
template_option_setting(template: template, namespace: "aws:elasticbeanstalk:command", option_name: "BatchSizeType", default: "Fixed", new_settings: option_settings),
|
53
53
|
template_option_setting(template: template, namespace: "aws:elasticbeanstalk:command", option_name: "DeploymentPolicy", default: "Rolling", new_settings: option_settings),
|
54
|
-
template_option_setting(template: template, namespace: "aws:elasticbeanstalk:application:environment", option_name: "
|
54
|
+
template_option_setting(template: template, namespace: "aws:elasticbeanstalk:application:environment", option_name: "PROCESS_ACTIVE_ELASTIC_JOBS", default: "true", new_settings: option_settings),
|
55
55
|
template_option_setting(template: template, namespace: "aws:elasticbeanstalk:application:environment", option_name: "ELASTIC_BEANS_ENV_VARS", default: config_path, new_settings: option_settings),
|
56
56
|
template_option_setting(template: template, namespace: "aws:elasticbeanstalk:environment", option_name: "ServiceRole", default: "aws-elasticbeanstalk-service-role", new_settings: option_settings),
|
57
57
|
template_option_setting(template: template, namespace: "aws:elasticbeanstalk:healthreporting:system", option_name: "SystemType", default: "enhanced", new_settings: option_settings),
|
@@ -15,7 +15,7 @@ module ElasticBeans
|
|
15
15
|
def build_option_settings(option_settings: [], **_)
|
16
16
|
super + [
|
17
17
|
template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTP:80/", new_settings: option_settings),
|
18
|
-
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "
|
18
|
+
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "PROCESS_ACTIVE_ELASTIC_JOBS", override: "false", new_settings: option_settings),
|
19
19
|
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "ELASTIC_BEANS_EXEC_QUEUE_URL", override: application.exec_queue_url, new_settings: option_settings),
|
20
20
|
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "true", new_settings: option_settings),
|
21
21
|
]
|
@@ -14,7 +14,7 @@ module ElasticBeans
|
|
14
14
|
def build_option_settings(option_settings: [], **_)
|
15
15
|
super + [
|
16
16
|
template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTP:80/", new_settings: option_settings),
|
17
|
-
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "
|
17
|
+
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "PROCESS_ACTIVE_ELASTIC_JOBS", override: "false", new_settings: option_settings),
|
18
18
|
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "true", new_settings: option_settings),
|
19
19
|
]
|
20
20
|
end
|
@@ -27,7 +27,7 @@ module ElasticBeans
|
|
27
27
|
def build_option_settings(option_settings: [], **_)
|
28
28
|
super + [
|
29
29
|
template_option_setting(namespace: "aws:elasticbeanstalk:application", option_name: "Application Healthcheck URL", default: "HTTP:80/", new_settings: option_settings),
|
30
|
-
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "
|
30
|
+
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "PROCESS_ACTIVE_ELASTIC_JOBS", override: "false", new_settings: option_settings),
|
31
31
|
template_option_setting(namespace: "aws:elasticbeanstalk:application:environment", option_name: "RAILS_SKIP_MIGRATIONS", default: "true", new_settings: option_settings),
|
32
32
|
template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "InactivityTimeout", default: "1800", new_settings: option_settings),
|
33
33
|
template_option_setting(namespace: "aws:elasticbeanstalk:sqsd", option_name: "MaxRetries", default: "10", new_settings: option_settings),
|
@@ -31,8 +31,8 @@ module ElasticBeans
|
|
31
31
|
attr_reader :app, :logger
|
32
32
|
|
33
33
|
def enabled?
|
34
|
-
|
35
|
-
|
34
|
+
worker_enabled = ENV['PROCESS_ACTIVE_ELASTIC_JOBS']
|
35
|
+
worker_enabled == 'true'
|
36
36
|
end
|
37
37
|
|
38
38
|
def health_request?(request)
|