devkitkat 0.1.0 → 0.1.1
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/.gitlab-ci.yml +13 -3
- data/README.md +35 -14
- data/lib/devkitkat/config.rb +10 -4
- data/lib/devkitkat/executor/docker.rb +6 -1
- data/lib/devkitkat/service.rb +1 -1
- data/lib/devkitkat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e730a451bae542a99bfa35ea7f4f5c0eb3f65da04c1b6e686e3d8dce16770c07
|
4
|
+
data.tar.gz: e865d0c254cff4b007b2680ef0e61f62fff9cd2b1dbddb2c53dde21b888f4016
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f1f690b3a05189d32ba031d8f1b5d40b92a7ca9879af34142c45dc07565f50459e56f65cfa48b4b1368c768d27ebfd6d13c342af11663cd5893b42c696789c1
|
7
|
+
data.tar.gz: f80a184c8992db158b4750d0c3421109f3ea0e74f51f94bb480e6e5b245cc8802998650b38cace5beb1cf0147b0bc68f71485ada2aedc8c446f52f3bf122b546
|
data/.gitlab-ci.yml
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
image: ruby:2.6
|
2
2
|
|
3
|
+
services:
|
4
|
+
- docker:19.03.1-dind
|
5
|
+
|
6
|
+
variables:
|
7
|
+
DOCKER_HOST: tcp://docker:2375
|
8
|
+
DOCKER_TLS_CERTDIR: ""
|
9
|
+
|
3
10
|
rspec:
|
4
11
|
stage: test
|
5
12
|
variables:
|
@@ -7,9 +14,12 @@ rspec:
|
|
7
14
|
LC_ALL: C.UTF-8
|
8
15
|
before_script:
|
9
16
|
- apt-get update
|
10
|
-
- apt-get install -y cmake
|
11
|
-
-
|
12
|
-
-
|
17
|
+
- apt-get install -y cmake docker.io
|
18
|
+
- docker info
|
19
|
+
- pwd
|
13
20
|
script:
|
21
|
+
- mkdir ../test
|
22
|
+
- cp -a . ../test
|
23
|
+
- cd ../test
|
14
24
|
- bin/setup
|
15
25
|
- bundle exec rspec
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://gitlab.com/dosuken123/devkitkat/commits/master)
|
2
2
|
|
3
3
|
# Devkitkat
|
4
4
|
|
@@ -6,17 +6,26 @@ Devkitkat is a framework for development kits. It lets you
|
|
6
6
|
bootstrap separate services for running a complex application easily.
|
7
7
|
This is especially helpful for local development that runs/compiles everything from source code.
|
8
8
|
|
9
|
+
## Key concepts
|
10
|
+
|
11
|
+
- It's an alternative solution of docker-compose.
|
12
|
+
- It's an alternative solution of Makefile.
|
13
|
+
- Convention over configuration. No need to write up complicated config file from scratch.
|
14
|
+
- Prepare one image to work on everything (All you need is runnable VM not
|
15
|
+
fully fine-tuned containers/images for deployments)
|
16
|
+
- Respect the best practice architecture of Cloud Native.
|
17
|
+
- No more Makefile for bootstraping.
|
18
|
+
|
9
19
|
## Features
|
10
20
|
|
11
21
|
This tool provides the following features:
|
12
22
|
|
13
|
-
-
|
14
|
-
-
|
15
|
-
-
|
16
|
-
-
|
17
|
-
- Easy to run services in containers
|
23
|
+
- Maintain your services in clean and explicit architecture.
|
24
|
+
- Control services with an easy and intuitive command.
|
25
|
+
- Fully customizable scripts.
|
26
|
+
- Logging everything by default.
|
27
|
+
- Easy to run services in containers.
|
18
28
|
- Distrubte machine resources to the cloud VM (Not available yet).
|
19
|
-
- No more Makefile for orchestrating services.
|
20
29
|
|
21
30
|
## The only config file - `.devkitkat.yml`
|
22
31
|
|
@@ -25,25 +34,32 @@ download/prepare services. These are available keys.
|
|
25
34
|
|
26
35
|
|Key |Type |Required|Default|Description|
|
27
36
|
|--- |--- |--- |---|---|
|
28
|
-
|`application:` |String |Yes |-|The name of the application that consists of the services|
|
29
|
-
|`environment:type:` |String |Yes |-|The type of the environment. One of `local`, `docker` or `cloud`. Default is `local`.|
|
30
|
-
|`environment:image:` |String |Yes |-|The docker image. Only effective when `type` is `docker` or `cloud`|
|
31
37
|
|`services:` |Hash |Yes |-|The services to run the application|
|
32
38
|
|`services:<name>` |Hash |Yes |-|The service name e.g. `rails`, `db`, `redis`|
|
33
39
|
|`services:<name>:repo: <value>` |String |No |-|The git URL of the repository|
|
34
40
|
|`services:<name>:<key>: <value>` |Hash |No |-|The key and value of the environment variable. e.g. `POSTGRES_PASSWORD: abcdef`. |
|
41
|
+
|`image:` |String |No |-|The docker image. Only effective when `type` is `docker` or `cloud`|
|
35
42
|
|`groups:` |Hash |No |-|The groups of the services|
|
36
43
|
|`groups:<name>: <service-names>` |Hash |No |-|The name of the group and the service names|
|
44
|
+
|`application:` |String |No |-|The name of the application that consists of the services|
|
37
45
|
|
38
46
|
There are pre-occupied special keys, please do not use these keys in your config file: `services:system`, `services:self`
|
39
47
|
|
40
|
-
## Sample `.devkitkat.yml`
|
48
|
+
## Sample `.devkitkat.yml` that runs services in local environment
|
41
49
|
|
42
50
|
```yaml
|
43
|
-
|
51
|
+
services:
|
52
|
+
web:
|
53
|
+
repo: https://gitlab.com/gitlab-org/gitlab-ce.git
|
54
|
+
port: 1234
|
55
|
+
db:
|
56
|
+
port: 9999
|
57
|
+
```
|
44
58
|
|
45
|
-
|
46
|
-
|
59
|
+
## Sample `.devkitkat.yml` that runs services in docker containers
|
60
|
+
|
61
|
+
```yaml
|
62
|
+
image: ruby:2.6
|
47
63
|
|
48
64
|
services:
|
49
65
|
web:
|
@@ -55,6 +71,11 @@ services:
|
|
55
71
|
|
56
72
|
## Devkitkat image
|
57
73
|
|
74
|
+
The key concept is to prepare only one docker image to run services. It's just a
|
75
|
+
virtual machine just like your local computer. You install native applications/runtime
|
76
|
+
(such as postgresql) on your computer. We just need one workable image. So each
|
77
|
+
service has an individual container which initialized from the single image.
|
78
|
+
|
58
79
|
When you run your application with docker containers, you might need to write up
|
59
80
|
[Dockerfile](https://docs.docker.com/engine/reference/builder/) and build the image at first,
|
60
81
|
this often is time consuming and repeatable task.
|
data/lib/devkitkat/config.rb
CHANGED
@@ -2,6 +2,8 @@ module Devkitkat
|
|
2
2
|
class Config
|
3
3
|
DEVKITKAT_FILE_NAME = '.devkitkat.yml'
|
4
4
|
HIDDEN_SERVICES = %w[system]
|
5
|
+
DEFAULT_APPLICATION_NAME = 'devkitkat'
|
6
|
+
DEFAULT_IMAGE = 'ubuntu:18.04'
|
5
7
|
|
6
8
|
attr_reader :devkitkat_yml, :kit_root
|
7
9
|
|
@@ -33,15 +35,19 @@ module Devkitkat
|
|
33
35
|
end
|
34
36
|
|
35
37
|
def environment_type
|
36
|
-
devkitkat_yml.
|
38
|
+
if devkitkat_yml.key?('image')
|
39
|
+
'docker'
|
40
|
+
else
|
41
|
+
'local'
|
42
|
+
end
|
37
43
|
end
|
38
44
|
|
39
|
-
def
|
40
|
-
devkitkat_yml.
|
45
|
+
def image
|
46
|
+
devkitkat_yml.fetch('image', DEFAULT_IMAGE)
|
41
47
|
end
|
42
48
|
|
43
49
|
def application
|
44
|
-
devkitkat_yml.fetch('application',
|
50
|
+
devkitkat_yml.fetch('application', DEFAULT_APPLICATION_NAME)
|
45
51
|
end
|
46
52
|
|
47
53
|
def variables
|
@@ -13,6 +13,7 @@ module Devkitkat
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def prepare
|
16
|
+
pull_image
|
16
17
|
start_container
|
17
18
|
end
|
18
19
|
|
@@ -48,7 +49,7 @@ module Devkitkat
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def docker_image
|
51
|
-
config.
|
52
|
+
config.image
|
52
53
|
end
|
53
54
|
|
54
55
|
def container
|
@@ -84,6 +85,10 @@ module Devkitkat
|
|
84
85
|
"/devkitkat"
|
85
86
|
end
|
86
87
|
|
88
|
+
def pull_image
|
89
|
+
::Docker::Image.create('fromImage' => docker_image)
|
90
|
+
end
|
91
|
+
|
87
92
|
def start_container
|
88
93
|
container.start
|
89
94
|
end
|
data/lib/devkitkat/service.rb
CHANGED
@@ -152,7 +152,7 @@ See the log file: #{log_path}]
|
|
152
152
|
end
|
153
153
|
|
154
154
|
def add_script
|
155
|
-
names = command.args.any? ? command.args : %w[configure unconfigure start
|
155
|
+
names = command.args.any? ? command.args : %w[configure unconfigure start]
|
156
156
|
|
157
157
|
FileUtils.mkdir_p(script_dir)
|
158
158
|
|
data/lib/devkitkat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devkitkat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shinya Maeda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|