orchparty 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/CNAME +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/LICENSE +165 -0
- data/README.md +363 -0
- data/Rakefile +6 -0
- data/_config.yml +1 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/orchparty +15 -0
- data/lib/deep_merge.rb +106 -0
- data/lib/hash.rb +28 -0
- data/lib/orchparty/ast/application.rb +7 -0
- data/lib/orchparty/ast/mixin.rb +6 -0
- data/lib/orchparty/ast/root.rb +6 -0
- data/lib/orchparty/ast/service.rb +6 -0
- data/lib/orchparty/ast.rb +16 -0
- data/lib/orchparty/context.rb +12 -0
- data/lib/orchparty/dsl_parser.rb +186 -0
- data/lib/orchparty/generators/docker_compose_v1.rb +20 -0
- data/lib/orchparty/generators/docker_compose_v2.rb +23 -0
- data/lib/orchparty/generators.rb +7 -0
- data/lib/orchparty/transformations/all.rb +19 -0
- data/lib/orchparty/transformations/mixin.rb +35 -0
- data/lib/orchparty/transformations/remove_internal.rb +16 -0
- data/lib/orchparty/transformations/variable.rb +38 -0
- data/lib/orchparty/transformations.rb +16 -0
- data/lib/orchparty/version.rb +3 -0
- data/lib/orchparty.rb +24 -0
- data/orchparty.gemspec +34 -0
- metadata +185 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f89243d6fae72722e405faaebd5474333b809fe7
|
4
|
+
data.tar.gz: f91105683995435802fd753a8898e70dc5ecc280
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 817fbaaa5bfed13ca75119641c50f30c59acfeb96d4570628595406bec6d2b1932ca8f45d960034954132d8f889e52b65befe96c601534e974d6aa6ee18f9d77
|
7
|
+
data.tar.gz: c9d8e7430128f01d17623e509ad5896892a6a2105fec115f1a84f4f6d2853307e6547aa85c87a6986ca5e372500799a79a1d0d566248914fc702629e70bc9729
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.2
|
5
|
+
- 2.3
|
6
|
+
- 2.4
|
7
|
+
before_install: gem install bundler -v 1.13.6
|
8
|
+
install: bundle install
|
9
|
+
script: bundle exec rspec
|
10
|
+
deploy:
|
11
|
+
provider: rubygems
|
12
|
+
api_key:
|
13
|
+
secure: XnUBF2iCbMQXD/hUDcbOF2Y66x2A+Fjg0qx5ceJB7ctOnh2Q6NWMjcxF0oINteryzY78gbI3BB0GnemX8nrvJ/kLxgVWSOPBPlR1ufREekSkElPnccGi6oH8D6goI0d3rtB81cwOzJl+BhXCLFiJRvySOmDBw87ENhianMwhNf+6oW/QgAHKHKuu9hJM91u5Z+8dw8x5iqMtxxiiCPSmd9T6PDknJDD3sz2XdSOMGRQO9EqFQSdngX6AbRRgOewY+klXCut44Vc8SefIqtmRQ6/VF5onTNeLL4ZJkiazS2r4Xi93jl0/lzIamqDIinbVFx5xVH1Kb3JyjkRnW/Ah6tHtwQZlJUuJLQbRFKDY+w3dXKKn7rLaV3neQ9q/0TxlHuUQqQsLV6cY38Xb0y/x+xYvNaWy7oDLe836dHIvxec3Ea7t0wt2HMk5jVuFDNm3TnSvu7mYbF+ZoYyYLFLtX35KMu7WMDQnHU6zvJPdE6EFENoximY/MiX0vvco0Z4HiQmJFRrmvA/gGKgn7qpan+6oysrLg/oVWOgYbc5BQmLoX9jxnb//BSWlxxD85tBGlG/IO1pOU/FAFNlbheqxfoF/YUyWJQCIX0V1H13+10KuLBSSX+lg4BkxmluWC4VsqMeMwTHtEgKb7x7nIJsRxmcvyqIeD/noCoSooLgUH+A=
|
14
|
+
gem: orchparty
|
15
|
+
on:
|
16
|
+
tags: true
|
17
|
+
repo: jannishuebl/orchparty
|
18
|
+
rvm: 2.4
|
data/CNAME
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
orch.party
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at jannis.huebl@web.de. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.md
ADDED
@@ -0,0 +1,363 @@
|
|
1
|
+
# Orchparty
|
2
|
+
|
3
|
+
[](https://travis-ci.org/jannishuebl/orchparty)
|
4
|
+
|
5
|
+
Write your orchestration configuration with a Ruby DSL that allows you to have mixins, imports and variables.
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
import "../logging.rb"
|
9
|
+
|
10
|
+
application 'my-cool-app' do
|
11
|
+
variables do
|
12
|
+
var port: 8080
|
13
|
+
end
|
14
|
+
|
15
|
+
service "api" do
|
16
|
+
mix "logging.syslog"
|
17
|
+
image "my-cool-image:latest"
|
18
|
+
commad -> { "bundle exec rails s -b 0.0.0.0 -p #{port}" }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
## Why the Hell?
|
25
|
+
|
26
|
+
### 1. Powerfull Ruby DSL as a YAML replacement
|
27
|
+
|
28
|
+
Yaml is great when it comes to Configuration, it gives a clean syntax that is
|
29
|
+
build for humans, but is still maschine readable. For most of the
|
30
|
+
configurations it is good enough. It even supports features like referencing,
|
31
|
+
inheritence and multiline Strings.
|
32
|
+
|
33
|
+
In our company we run a microservcie architecture with multiple applications,
|
34
|
+
that by themselves consits of multiple services (container types).
|
35
|
+
But what we have realizes was that our orchestration configuration grew and got
|
36
|
+
hell complex, which made globle changes like replacing our logging
|
37
|
+
infrastucture quite painfull, because we need to touch every single service.
|
38
|
+
|
39
|
+
Some features that we wanted to have:
|
40
|
+
|
41
|
+
1. Mixin support
|
42
|
+
1. Import from diffrent files
|
43
|
+
1. Using Variables in imported config eg. Stack/Service names
|
44
|
+
|
45
|
+
|
46
|
+
Some of the features are build in YAML but were to complex for us to use.
|
47
|
+
|
48
|
+
|
49
|
+
### 2. Use Ruby instead of Templating engines
|
50
|
+
|
51
|
+
Most of the Orchestrationframeworks are using a docker-compose.yml derivat.
|
52
|
+
But what most of them realized is that yml is not enough for komplex
|
53
|
+
orchestration.
|
54
|
+
|
55
|
+
So most of the framework teams stated to allow a templatingengine in the
|
56
|
+
docker-compose configuration.
|
57
|
+
|
58
|
+
But why keep going with a data serialization language when we want to program
|
59
|
+
our configuration anyway?
|
60
|
+
|
61
|
+
### 3. Have one config for multiple Orchestrationframeworks
|
62
|
+
|
63
|
+
How much effort is it to get a application running on an
|
64
|
+
Orchestrationframeworks? We am glad when we find a prebuild docker-compose file
|
65
|
+
that we can modify eg. for kontena.io, but when we have done it for konena.io we
|
66
|
+
have to redo nearly all the work for rancher, kubernets etc.
|
67
|
+
|
68
|
+
It would be nice if people start to write the opensource application configs in
|
69
|
+
orchparty and we simple compile the config for all popular orchestrationframeworks.
|
70
|
+
|
71
|
+
## Installation
|
72
|
+
|
73
|
+
For installation it is nessery to have setup a ruby environment, at lease ruby
|
74
|
+
2.2 is needed.
|
75
|
+
|
76
|
+
Install from rubygems.org
|
77
|
+
|
78
|
+
$ gem install orchparty
|
79
|
+
|
80
|
+
Maybe in the future it is possible to run it in a docker container, so no local
|
81
|
+
ruby environment is needed.
|
82
|
+
|
83
|
+
## Usage
|
84
|
+
|
85
|
+
See the commandline usage instrucution by running:
|
86
|
+
|
87
|
+
$ orchparty help
|
88
|
+
|
89
|
+
## DSL spec
|
90
|
+
|
91
|
+
So lets do an example let us orchparty a beutiful app called [app_perf](https://github.com/randy-girard/app_perf) that is a
|
92
|
+
open source replacement of new relic !
|
93
|
+
|
94
|
+
### Applications
|
95
|
+
|
96
|
+
app_perf need a postgres to store data, redis for a queing system, a web
|
97
|
+
handler, where all metrics are send to, and a worker that process the metrics
|
98
|
+
and inserts them to the postgres db.
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
application "app_perf" do
|
102
|
+
|
103
|
+
service "web" do
|
104
|
+
image "blasterpal/app_perf"
|
105
|
+
command "bundle exec rails s -p 5000"
|
106
|
+
expose 5000
|
107
|
+
links do
|
108
|
+
link "redis"
|
109
|
+
link "postgres"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
service "worker" do
|
114
|
+
image "blasterpal/app_perf"
|
115
|
+
command "bundle exec sidekiq"
|
116
|
+
links do
|
117
|
+
link "redis"
|
118
|
+
link "postgres"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
service "redis" do
|
123
|
+
image "redis"
|
124
|
+
end
|
125
|
+
|
126
|
+
service "postgres" do
|
127
|
+
image "postgres"
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
```
|
132
|
+
|
133
|
+
|
134
|
+
### Applevel Mixins
|
135
|
+
|
136
|
+
But maybe we would want a production setup where we do not shipp a postgres
|
137
|
+
because we want to use an exteral services like RDS from AWS.
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
mixin "app_perf" do
|
141
|
+
|
142
|
+
service "web" do
|
143
|
+
image "blasterpal/app_perf"
|
144
|
+
command "bundle exec rails s -p 5000"
|
145
|
+
expose 5000
|
146
|
+
links do
|
147
|
+
link "redis"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
service "worker" do
|
152
|
+
image "blasterpal/app_perf"
|
153
|
+
command "bundle exec sidekiq"
|
154
|
+
links do
|
155
|
+
link "redis"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
service "redis" do
|
160
|
+
image "redis"
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
application 'app_perf-dev' do
|
166
|
+
mix "app_perf"
|
167
|
+
|
168
|
+
service "web" do
|
169
|
+
links do
|
170
|
+
link "postgres"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
service "worker" do
|
175
|
+
links do
|
176
|
+
link "postgres"
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
service "postgres" do
|
181
|
+
image "postgres"
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
application 'app_perf-prod' do
|
187
|
+
mix "app_perf"
|
188
|
+
|
189
|
+
service "web" do
|
190
|
+
environment do
|
191
|
+
env POSTGRES_HOST: "rds-domain.amazon.com"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
service "worker" do
|
196
|
+
environment do
|
197
|
+
env POSTGRES_HOST: "rds-domain.amazon.com"
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
```
|
203
|
+
|
204
|
+
### Service level Mixin
|
205
|
+
|
206
|
+
But we might also mixin a logging config in production.
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
mixin "logging" do
|
210
|
+
|
211
|
+
service "syslog" do
|
212
|
+
logging do
|
213
|
+
conf driver: "syslog"
|
214
|
+
options do
|
215
|
+
opt syslog-address: "tcp://192.168.0.42:123"
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
|
222
|
+
|
223
|
+
application 'app_perf-prod' do
|
224
|
+
mix "app_perf"
|
225
|
+
|
226
|
+
service "web" do
|
227
|
+
mix "logging.syslog"
|
228
|
+
environment do
|
229
|
+
env POSTGRES_HOST: "rds-domain.amazon.com"
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
service "worker" do
|
234
|
+
mix "logging.fluentd"
|
235
|
+
environment do
|
236
|
+
env POSTGRES_HOST: "rds-domain.amazon.com"
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
end
|
241
|
+
```
|
242
|
+
|
243
|
+
### Commonblock
|
244
|
+
|
245
|
+
Maybe we want to add something to all services in one application. Of cause
|
246
|
+
this also adds the mix "logging.syslog" and environment variables to the redis and postgres service.
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
application 'app_perf-prod' do
|
250
|
+
mix "app_perf"
|
251
|
+
|
252
|
+
all do
|
253
|
+
mix "logging.syslog"
|
254
|
+
environment do
|
255
|
+
env POSTGRES_HOST: "rds-domain.amazon.com"
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
service "web" do
|
260
|
+
end
|
261
|
+
|
262
|
+
service "worker" do
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
266
|
+
```
|
267
|
+
|
268
|
+
### Variables
|
269
|
+
|
270
|
+
You want to use variables right? Becase DRY ;) well you can:
|
271
|
+
|
272
|
+
```ruby
|
273
|
+
application "app_perf" do
|
274
|
+
variables do
|
275
|
+
var image: "blasterpal/app_perf"
|
276
|
+
end
|
277
|
+
|
278
|
+
service "web" do
|
279
|
+
variables do
|
280
|
+
# service local variables
|
281
|
+
end
|
282
|
+
image -> { image }
|
283
|
+
command -> { "bundle exec rails s -p #{ service.expose }" }
|
284
|
+
expose 5000
|
285
|
+
links do
|
286
|
+
link "redis"
|
287
|
+
link "postgres"
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
service "worker" do
|
292
|
+
image -> { image }
|
293
|
+
command "bundle exec sidekiq"
|
294
|
+
links do
|
295
|
+
link "redis"
|
296
|
+
link "postgres"
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
service "redis" do
|
301
|
+
image "redis"
|
302
|
+
end
|
303
|
+
|
304
|
+
service "postgres" do
|
305
|
+
image "postgres"
|
306
|
+
end
|
307
|
+
|
308
|
+
end
|
309
|
+
```
|
310
|
+
|
311
|
+
special variables:
|
312
|
+
|
313
|
+
1. service:
|
314
|
+
- service.name
|
315
|
+
1. application:
|
316
|
+
- application.name
|
317
|
+
|
318
|
+
### Import
|
319
|
+
|
320
|
+
Above we assumend that everything is written in one file. If you donot want to
|
321
|
+
to that use the import feature.
|
322
|
+
|
323
|
+
```ruby
|
324
|
+
import "../logging.rb"
|
325
|
+
import "./app_perf.rb"
|
326
|
+
|
327
|
+
application 'app_perf-prod' do
|
328
|
+
mix "app_perf"
|
329
|
+
|
330
|
+
all do
|
331
|
+
mix "logging.syslog"
|
332
|
+
environment do
|
333
|
+
env POSTGRES_HOST: "rds-domain.amazon.com"
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
end
|
338
|
+
```
|
339
|
+
|
340
|
+
|
341
|
+
## Development
|
342
|
+
|
343
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
344
|
+
Then, run `rake spec` to run the tests.
|
345
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
346
|
+
|
347
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
348
|
+
To release a new version, update the version number in `version.rb`,
|
349
|
+
and then run `bundle exec rake release`,
|
350
|
+
which will create a git tag for the version,
|
351
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
352
|
+
|
353
|
+
## Contributing
|
354
|
+
|
355
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jannishuebl/orchparty.
|
356
|
+
This project is intended to be a safe, welcoming space for collaboration,
|
357
|
+
and contributors are expected to adhere to the
|
358
|
+
[Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
359
|
+
|
360
|
+
|
361
|
+
## License
|
362
|
+
|
363
|
+
The gem is available as open source under the terms of the [GNU Lesser General Public License v3.0](http://www.gnu.de/documents/lgpl-3.0.en.html).
|
data/Rakefile
ADDED
data/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
theme: jekyll-theme-minimal
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "orchparty"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|