minke 1.12.3 → 1.12.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDI0NDFjZGFhNjVmYTNlY2NiYmEyNTA4Y2JjMjFjNTIyNTc2ZTE1ZQ==
4
+ MDUzZTZiYjZiNjgyODIxMmYwNGY1YzM5ZGI2MGE1MGI1Yjc0ODg4Nw==
5
5
  data.tar.gz: !binary |-
6
- MDkwYjYzMWYwMGI4OTFkOWVmNzdiZmFmNjE3NmYyMmQwOWUyOThmZA==
6
+ Mzg4OTQ0Y2Q2NmNmZDZkMzk4OTZmZGIxNjQ4NmYzZTM2NzYwM2Y0Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTc5ZGM1MGQ5ZWFlYWViYzRmYWNkZDZlYTBjODIzMmRkZmYxNGM5MWRkMjEw
10
- MmYxZmNmOGFiM2RiYjkyZmM0MGYxM2E4NTVmOWU3YzFiNGI5OGFjMDkzZTAz
11
- MmY2MGZlODE4OGE1OGEzNzViZThlZTljYWFiNmEyNmE4NmZkZGU=
9
+ MGQ3YTYxODE1OWM4MDA0MzlhOGRiMWNjOWQxODlmZTcxZThhMzA2YzVlNjQw
10
+ ZTc4YTQ1YTk5MzQyNmZmNzdlNDViNzIwY2RjNmRjZjJiZTJhM2JiZTg2OGM1
11
+ ODAwZmUxZDhiZmRlYzFlZGE2M2ZhZTg2ZTdhMWI3NzBmMTc2MDc=
12
12
  data.tar.gz: !binary |-
13
- NTFlMmJkZmRhZDk3ZGIxNWE3ZGFkYWEyODY1YmVmNTIxODU0NzIyZmI2ZGUy
14
- NDQxM2I5NmUwOTZkMjVmMzY5ZjFhZGJlN2I3MmQ1YWFlOWMwMTRlYmQxOTRi
15
- YWFmN2E0ZGE0MDYxNzI2MjI3MzYwOTc0YzQzMDk5NzUwNzBhNzg=
13
+ ZGYwMzEyZjljYjVjYWE1NjU2OTIyYTg0YmRiNjY4NzIxZWNkZWE4NTVmNTY4
14
+ ODQwYmJmMzQwZjcwOGMyMzQyMzY1ZDI2MjViMWVmZjBiM2FlNTFmM2RjY2Vj
15
+ YTk2YTViYzAwNTc0N2E1ZDliNjFmMzE2YjM0NThlNjJhNmVhNTE=
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  .DS_Store
11
+ /_site
data/README.md CHANGED
@@ -2,187 +2,42 @@
2
2
 
3
3
  [![Join the chat at https://gitter.im/nicholasjackson/minke](https://badges.gitter.im/nicholasjackson/minke.svg)](https://gitter.im/nicholasjackson/minke?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
 
5
- ## NOTE:
6
- Version 1 is pretty much a complete rewrite which supports new generator plugins to scaffold applications and greater compatibility for running docker compose on CI environments. Documentation is coming soon (as in hopefully tomorrow), but for the moment I apologize but the documentation below is a little out of date.
5
+ # Documentation and Tutorial
6
+ [http://minke.rocks/index.html](http://minke.rocks/index.html)
7
7
 
8
- Version 1.0 is not compatible with previous versions of minke however upgrading is not so painful, full instructions will be updated shortly. In the mean time please continue to use the previous stable 0.1.5 [https://github.com/nicholasjackson/minke/tree/0.1.5](https://github.com/nicholasjackson/minke/tree/0.1.5).
8
+ # Quick Start
9
+ Minke is an opinionated build system for μServices and Docker, it uses generator templates to create working source code, Dockerfiles, and anything else you may need to build and deploy a working microservice.
9
10
 
10
- **Version 1.0.1**
11
- [![Build Status](https://travis-ci.org/nicholasjackson/minke.svg?branch=master)](https://travis-ci.org/nicholasjackson/minke)
11
+ The intention is to produce a 0 dependency standardised build and test framework that works equally well on CI as it does on your local machine.
12
12
 
13
- [![Code Climate](https://codeclimate.com/github/nicholasjackson/minke/badges/gpa.svg)](https://codeclimate.com/github/nicholasjackson/minke)
13
+ ## Scaffold a new service
14
+ 1. Create the folder where you would like the new service and change into that directory. Whilst we are building a Go microservice in this example you do not need to create this folder in your GOPATH if you are only going to build with Minke as the generator uses the new vendoring capability introduced in Go 1.5.
14
15
 
15
- [![Test Coverage](https://codeclimate.com/github/nicholasjackson/minke/badges/coverage.svg)](https://codeclimate.com/github/nicholasjackson/minke/coverage)
16
-
17
- [![Issue Count](https://codeclimate.com/github/nicholasjackson/minke/badges/issue_count.svg)](https://codeclimate.com/github/nicholasjackson/minke)
18
-
19
- Minke is an opinionated build system for Microservices and Docker, like a little envelope of quality it scaffolds the build, run and test (unit test and functional tests) phases of your microservice project allowing you to simply run and test your images using Docker Compose. Currently supporting Google's Go, and experimental support for Swift, extensions are planned for Node.js or HTML / Javascript sites with Grunt or Gulp based builds.
20
-
21
- ## Generators
22
- - Go - [Go Microservice Template](https://github.com/nicholasjackson/minke-generator-go)
23
- - .NET Core - [.NET MVC Microservice Template](https://github.com/nicholasjackson/minke-generator-netmvc)
24
- - Java - Spring Boot
25
- - Swift - Kitura (Coming Soon)
26
- - Node - ExpressJS (Coming Soon)
27
- - Ruby - Rails (Coming Soon)
28
-
29
- ## Installation
30
-
31
- Add this line to your application's Gemfile:
32
-
33
- ```ruby
34
- gem 'minke'
16
+ ```bash
17
+ $ mkdir ~/myservice
18
+ $ cd ~/myservice
35
19
  ```
36
20
 
37
- And then execute:
38
-
39
- $ bundle
40
-
41
- Or install it yourself as:
21
+ 2. Run the generator command in a docker container. (note the space before -g)
42
22
 
43
- $ gem install minke
44
-
45
- ## Dependencies
46
-
47
- ### Docker
48
- You need to have docker, docker-machine, and docker-compose installed on your build machine and the docker environment variables must be set. If using the docker-toolkit on a mac you can set these by running...
49
23
  ```bash
50
- eval "$(docker-machine env default)"
51
- ```
52
-
53
- ## Not for Docker for Mac Beta users
54
- If you use docker for mac please set the environment variable, this will auto resolve once Docker for mac exits beta.
55
- ```
56
- DOCKER_IP=[your docker vm ip]
24
+ $ curl -L -s get.minke.rocks | bash -s ' -g minke-generator-go -o $(pwd) -n github.com/nicholasjackson -a myservice'
57
25
  ```
58
26
 
59
- ## Usage
60
- Include the rake tasks in your Rakefile
61
- ```ruby
62
- require 'minke'
27
+ 3. Build a Docker image
63
28
 
64
- spec = Gem::Specification.find_by_name 'minke'
65
- Rake.add_rakelib "#{spec.gem_dir}/lib/minke/rake"
29
+ ```bash
30
+ $ cd _build
31
+ $ ./minke.sh rake app:build_image
66
32
  ```
67
33
 
68
- By default Go builder looks for a config file (config.yml) in the same folder as your Rakefile
69
-
70
- Go builder provides the following tasks...
71
-
72
- ### rake app:test
73
- Gets your packages dependencies then executes go test against the package.
74
-
75
- ### rake app:build
76
- Creates a linux binary for your application, runs app:test before execution.
77
-
78
- ### rake app:build_server
79
- Creates a docker image for your application, runs app:build before execution.
80
-
81
- ### rake app:build_and_run
82
- Creates a docker image for your application then starts the application using docker-compose, runs app:build_server before execution.
83
-
84
- ### rake app:cucumber[optional feature tag]
85
- Starts the application and then runs cucumber to execute your features, you can optionally pass a feature tag to this command to configure which part of your test suite you would like to run. Does not build the server before running, this needs to be done when you change your source code with app:build_server.
86
-
87
- ### rake app:push
88
- Pushes the built image to the configured registry, does not build the image before execution, this can be done manually with app:build_server.
89
-
90
- ## Config File
91
- The config file config.yml is where you set the various configuration for the build process.
92
-
93
- ### Example Config File
94
- ```yaml
95
- namespace: 'github.com/nicholasjackson'
96
- application_name: 'event-sauce'
97
- language: go
98
- docker_registry:
99
- url: <%= ENV['DOCKER_REGISTRY_URL'] %>
100
- user: <%= ENV['DOCKER_REGISTRY_USER'] %>
101
- password: <%= ENV['DOCKER_REGISTRY_PASS'] %>
102
- email: <%= ENV['DOCKER_REGISTRY_EMAIL'] %>
103
- namespace: <%= ENV['DOCKER_NAMESPACE'] %>
104
- docker:
105
- docker_file: './dockerfiles/event-sauce/Dockerfile'
106
- compose_file: './dockercompose/event-sauce/docker-compose.yml'
107
- build:
108
- image: [optional]
109
- docker_file: [optional]
110
- after_build:
111
- copy_assets:
112
- -
113
- from: <%= "#{ENV['GOPATH']}/src/github.com/nicholasjackson/event-sauce/event-sauce" %>
114
- to: './docker/event-sauce'
115
- -
116
- from: './swagger_spec/swagger.yml'
117
- to: './dockerfile/event-sauce/swagger_spec/swagger.yml'
118
- run:
119
- consul_loader:
120
- enabled: true
121
- config_file: './config.yml'
122
- url: <%= "http://#{ENV['DOCKER_IP']}:9500" %>
123
- docker:
124
- compose_file: './dockercompose/event-sauce/docker-compose-alternate.yml'
125
- cucumber:
126
- consul_loader:
127
- enabled: true
128
- config_file: './config.yml'
129
- url: <%= "http://#{ENV['DOCKER_IP']}:9500" %>
130
- health_check:
131
- enabled: true
132
- url: <%= "http://#{ENV['DOCKER_IP']}:8001/v1/health" %>
133
- after_start:
134
- - 'wait_for_elastic_search'
34
+ 4. Execute the functional tests
35
+
36
+ ```bash
37
+ $ ./minke.sh rake app:cucumber
135
38
  ```
136
39
 
137
- #### head:
138
- This section contains the configuration for the build process.
139
- **namespace:** namespace for your application code within your GOPATH, this is generally the same as your repository.
140
- **application_name:** name of the built binary.
141
- **language** (go|swift) language type of the build swift is currently experimental and uses the v3 dev branch which is compatible with Kitura
142
-
143
- #### docker_registry:
144
- This section contains the configuration for the docker registry to push the image to. Images are pushed to the registry prefixed with the namespace and application_name, e.g. nicholasjackson/event-sauce:latest.
145
- **url:** url for the docker registry.
146
- **user:** username to use when logging into the registry.
147
- **password:** password to use when logging into the registry.
148
- **email:** email address to use when logging into the registry.
149
- **namespace:** namespace of your image to use when pushing the image to the registry.
150
-
151
- #### after_build:
152
- This section allows you to copy assets such as binaries or files which you would like to include into your Docker image.
153
- ##### copy_assets:
154
- An array of elements with the following parameters:
155
- **from:** the source file or directory
156
- **to:** the destination file or directory
157
-
158
- #### docker:
159
- This section contains configuration for the Docker build and run process.
160
- **docker_file:** path to the folder containing your Dockerfile used by the build_server task.
161
- **compose_file:** path to your docker-compose file for run and cucumber tasks.
162
- **build:** This section allows you to override the language default used for building your application code.
163
- - **image [optional]:** specify a different image from your registry or local machine to use for building the application.
164
- - **docker_file [optional]:** specify a dockerfile which will be built into an image and then used for building the application.
165
-
166
- #### run:
167
- The run section defines config for running your microservice with Docker Compose.
168
- ##### consul_loader:
169
- When the application is run using docker-compose you can load some default config into your consul server. Told you this was opinionated, if you are building microservices you are using consul right?
170
- **enabled:** boolean determining if this feature is enabled.
171
- **config_file:** path to a yaml file containing the key values you would like to load into consul. consul_loader flattens the structure of your yaml file and converts this into key values. For more information please see []()
172
- ##### docker:
173
- This section allows you to override the docker compose file specified in the main section incase you would like a different config for testing.
174
- **compose_file:** path to your docker-compose file for run and cucumber tasks.
175
- ##### after_start:
176
- This section is an array of rake tasks which will be run after docker compose has started, you can define these rake tasks in your main Rakefile. e.g.
177
- - 'wait_for_elastic_search'
178
- - 'es:create_indexes'
179
-
180
- #### cucumber:
181
- The cucumber section defines config for running and testing your microservice with Docker Compose and cucumber, the config options are the same as in **run:** with the addition of health_check.
182
- ##### health_check:
183
- After the Docker Compose startup the application can wait until the main application has started before running the cucumber tests, to enable this specify true for the enabled: section then specify your health check url.
184
- **enabled** (true|false) enable or disable the health check.
185
- **url** url to use for health checks.
40
+ You now have a working microservice ready to be pushed to a Docker registry and deployed to a server. For more detailed information please see the [tutorial](tutorial.html).
186
41
 
187
42
  ## Development
188
43
 
data/docker/Dockerfile CHANGED
@@ -3,6 +3,18 @@ FROM debian:stable
3
3
  ENV COMPOSE_VERSION 1.7.1
4
4
  ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
5
5
 
6
+ # Build-time metadata as defined at http://label-schema.org
7
+ ARG BUILD_DATE
8
+ ARG VCS_REF
9
+ LABEL org.label-schema.build-date=$BUILD_DATE \
10
+ org.label-schema.docker.dockerfile="/docker/Dockerfile" \
11
+ org.label-schema.license="MIT" \
12
+ org.label-schema.name="Minke" \
13
+ org.label-schema.url="https://minke.rocks" \
14
+ org.label-schema.vcs-ref=$VCS_REF \
15
+ org.label-schema.vcs-type="Git" \
16
+ org.label-schema.vcs-url="https://github.com/nicholasjackson/minke"
17
+
6
18
  RUN apt-get update
7
19
  RUN apt-get -y install procps build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison rubygems ca-certificates apt-transport-https
8
20
 
@@ -11,7 +23,7 @@ RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 581
11
23
  RUN echo "deb https://apt.dockerproject.org/repo debian-jessie main" > /etc/apt/sources.list.d/docker.list
12
24
 
13
25
  RUN apt-get update
14
- RUN apt-get -y install docker-engine=1.9.0-0~jessie
26
+ RUN apt-get -y install docker-engine
15
27
 
16
28
  RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 && curl -L get.rvm.io | bash -s stable --ruby=2.3.1 --with-gems="bundle"
17
29
 
@@ -1,12 +1,15 @@
1
1
  #!/bin/bash
2
- DOCKER_SOCK="/var/run/docker.sock:/var/run/docker.sock"
3
2
  ERROR="Please specify a command e.g. ./minke.sh rake app:test"
3
+
4
+ DOCKER_SOCK="/var/run/docker.sock:/var/run/docker.sock"
4
5
  NEW_UUID=$(base64 /dev/urandom | tr -d '/+' | head -c 32 | tr '[:upper:]' '[:lower:]')
5
6
  GEMSET='minkegems'
6
7
  GEMSETFOLDER="/usr/local/rvm/gems/ruby-2.3.1@${GEMSET}"
7
8
  RVM_COMMAND="source /usr/local/rvm/scripts/rvm && rvm gemset use ${GEMSET} --create"
9
+ DOCKER_IMAGE="nicholasjackson/minke:1.12.4"
8
10
  COMMAND=""
9
11
 
12
+
10
13
  if [ "$1" == '' ]; then
11
14
  echo $ERROR;
12
15
  exit 1;
@@ -17,13 +20,13 @@ COMMAND=$*
17
20
  if [[ $1 == \ -g* ]]; then
18
21
  echo "Generating new template"
19
22
  DIR=${PWD}
20
- DOCKER_RUN="docker run --rm -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -v ${DIR}/_build/vendor/gems:${GEMSETFOLDER} -e DOCKER_NETWORK=minke_${NEW_UUID} -w ${DIR} nicholasjackson/minke /bin/bash -c '${RVM_COMMAND} && bundle install && minke ${COMMAND}'"
23
+ DOCKER_RUN="docker run --rm -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -v ${DIR}/_build/vendor/gems:${GEMSETFOLDER} -e DOCKER_NETWORK=minke_${NEW_UUID} -w ${DIR} ${DOCKER_IMAGE} /bin/bash -c '${RVM_COMMAND} && bundle install && minke ${COMMAND}'"
21
24
  eval "${DOCKER_RUN}"
22
25
  fi
23
26
 
24
27
  if [[ $1 != \ -g* ]]; then
25
28
  DIR=$(dirname `pwd`)
26
- DOCKER_RUN="docker run --rm --net=minke_${NEW_UUID} -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -v ${DIR}/_build/vendor/gems:${GEMSETFOLDER} -e DOCKER_NETWORK=minke_${NEW_UUID} -w ${DIR}/_build nicholasjackson/minke /bin/bash -c '${RVM_COMMAND} && ${COMMAND}'"
29
+ DOCKER_RUN="docker run --rm --net=minke_${NEW_UUID} -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -v ${DIR}/_build/vendor/gems:${GEMSETFOLDER} -e DOCKER_NETWORK=minke_${NEW_UUID} -w ${DIR}/_build ${DOCKER_IMAGE} /bin/bash -c '${RVM_COMMAND} && ${COMMAND}'"
27
30
 
28
31
  echo "Running command: ${COMMAND}"
29
32
 
@@ -13,6 +13,9 @@ module Minke
13
13
  begin
14
14
  compose.up
15
15
  compose.logs
16
+ rescue SystemExit, Interrupt
17
+ puts "Stopping...."
18
+ raise
16
19
  ensure
17
20
  compose.down
18
21
  end
data/lib/minke/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Minke
2
- VERSION = "1.12.3"
2
+ VERSION = "1.12.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minke
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.3
4
+ version: 1.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Jackson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2016-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler