From 32ccff2541499637767649404fc0e93d1e9207d6 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Thu, 9 May 2019 17:27:45 -0600 Subject: [PATCH 1/9] Add more overcommit validations --- .overcommit.yml | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/.overcommit.yml b/.overcommit.yml index c2f3ccb..1226f90 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -13,27 +13,41 @@ # For a complete list of options that you can use to customize hooks, see: # https://github.com/brigade/overcommit#configuration # -# Uncomment the following lines to make the configuration take effect. quiet: false + PreCommit: -# RuboCop: -# enabled: true -# on_warn: fail # Treat all warnings as failures -# -# TrailingWhitespace: -# enabled: true -# exclude: -# - '**/db/structure.sql' # Ignore trailing whitespace in generated files -# Hadolint: enabled: true description: 'Analyze with Hadolint' required_executable: 'hadolint' include: - '**/Dockerfile*' -#PostCheckout: -# ALL: # Special hook name that customizes all hooks of this type -# quiet: true # Change all post-checkout hooks to only display output on failure -# -# IndexTags: -# enabled: true # Generate a tags file with `ctags` each time HEAD changes + +PostCheckout: + BundleInstall: + enabled: false + description: 'Install Bundler dependencies' + requires_files: true + required_executable: 'bundle' + install_command: 'gem install bundler' + flags: ['install'] + include: + - 'Gemfile' + - 'Gemfile.lock' + - '*.gemspec' + +CommitMsg: + CapitalizedSubject: + enabled: false + + EmptyMessage: + enabled: true + description: 'Check for empty commit message' + + RussianNovel: + enabled: false + description: 'Check length of commit message' + + SingleLineSubject: + enabled: true + description: 'Check subject line' From 9fb0df90dc3802c4823f97adef7deeefdb20dc21 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Thu, 9 May 2019 17:28:10 -0600 Subject: [PATCH 2/9] Bring in new dev deps --- Gemfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 4cd8c04..fb2f7b4 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,8 @@ source 'https://rubygems.org' gem 'gemstash', '2.0.0' group :development do - gem 'yaml-lint' gem 'rubocop' + gem 'rubocop-performance' + gem 'serverspec' + gem 'yaml-lint' end From f608f9bacb5d016797cef2f73190d038cca6122c Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Thu, 9 May 2019 17:28:36 -0600 Subject: [PATCH 3/9] Additional .gitignore files --- .gitignore | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2e96c91..ab51868 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,11 @@ # gem-jar/.gitignore -*.DS_Store +.DS_Store +.DS_Store? +*.DS_Store* +*.pem +.Spotlight-V100 +.Trashes +data/* db/* dive.log +._* From ec53427229908e95c909e719085ca8986201bc3c Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Thu, 9 May 2019 17:30:57 -0600 Subject: [PATCH 4/9] Update Gemfile.lock deps --- Gemfile.lock | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 6aff91f..98fbe0b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,6 +9,7 @@ GEM ast (2.4.0) concurrent-ruby (1.1.5) dalli (2.7.10) + diff-lcs (1.3) faraday (0.15.4) multipart-post (>= 1.2, < 3) faraday_middleware (0.13.1) @@ -30,8 +31,13 @@ GEM jaro_winkler (1.5.2) lru_redux (1.1.0) minitest (5.11.3) + multi_json (1.13.1) multipart-post (2.0.0) mustermann (1.0.3) + net-scp (2.0.0) + net-ssh (>= 2.6.5, < 6.0.0) + net-ssh (5.2.0) + net-telnet (0.1.1) parallel (1.17.0) parser (2.6.3.0) ast (~> 2.4.0) @@ -41,6 +47,22 @@ GEM rack-protection (2.0.5) rack rainbow (3.0.0) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-its (1.3.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.8.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) rubocop (0.67.2) jaro_winkler (~> 1.5.1) parallel (~> 1.10) @@ -49,16 +71,29 @@ GEM rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.6) + rubocop-performance (1.1.0) + rubocop (>= 0.67.0) ruby-progressbar (1.10.0) sequel (5.19.0) server_health_check (1.0.2) server_health_check-rack (0.1.0) server_health_check (~> 1.0, >= 1.0.1) + serverspec (2.41.3) + multi_json + rspec (~> 3.0) + rspec-its + specinfra (~> 2.72) + sfl (2.3) sinatra (2.0.5) mustermann (~> 1.0) rack (~> 2.0) rack-protection (= 2.0.5) tilt (~> 2.0) + specinfra (2.77.1) + net-scp + net-ssh (>= 2.7) + net-telnet (= 0.1.1) + sfl sqlite3 (1.4.0) thor (0.20.3) thread_safe (0.3.6) @@ -74,6 +109,8 @@ PLATFORMS DEPENDENCIES gemstash (= 2.0.0) rubocop + rubocop-performance + serverspec yaml-lint BUNDLED WITH From ae1c692bce2f87c080242adfa29a7b76d9fbed67 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Thu, 9 May 2019 18:02:10 -0600 Subject: [PATCH 5/9] Rm unnecessary EXPOSE line --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 96d2a9b..5012c2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,6 @@ LABEL version="0.1.1" COPY Gemfile* config.yml docker_health.rb / RUN bundle install --gemfile /Gemfile -EXPOSE 9292 CMD ["bundle", "exec", "gemstash", "start", "--no-daemonize", "--config-file", "/config.yml"] HEALTHCHECK CMD ruby docker_health.rb From 0166cc4a2803f5e8cf787e84f8911070ce98acb8 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Thu, 9 May 2019 18:02:28 -0600 Subject: [PATCH 6/9] Update README --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9cce0c5..9472ec1 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,19 @@ No nonsense Gemstash instance thrown in a container, backed by sqlite3 and wrapp ## Getting started 1. `git clone https://github.com/chefaustin/gem-jar.git` <= Clone this repo 2. `cd gem-jar` <= Navigate into it -3. `docker run --name gem-jar -p 9292:9292 -v $(pwd)/db:/root/.gemstash chefaustin/gem-jar:latest` <= Bring container up +3. `docker run --name gem-jar -p 9292:9292 -v ../db:/root/.gemstash chefaustin/gem-jar:latest` <= Bring container up 4. `resp_key=$(docker exec -it gem-jar gemstash authorize | cut -d ' ' -f 5)` <= Generate and grab a new API key 5. `mkdir -p ~/.gem; touch ~/.gem/credentials; echo ":gemstash: $resp_key"; chmod 0600 ~/.gem/credentials` <= Create and append key to `~/.gem/credentials` + +## Improvements to come: +- Tests: + - [Container Structure](https://github.com/GoogleContainerTools/container-structure-test) + - [Serverspec](https://github.com/mizzy/serverspec) + - [Dockerspec](https://github.com/zuazo/dockerspec) + - Fine-tune Docker `HEALTHCHECK` +- Other: + - Figure out proper FOSS `LICENSE` + - Build out wiki +- Functionality: + - Move to docker-compose with containerized ingress + - SSL/TLS termination (LetsEncrypt?) From 72a406cf401877f714047e812abf2c5fcb4591de Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Thu, 9 May 2019 18:04:19 -0600 Subject: [PATCH 7/9] Bring in Google's container-structure-test suite. --- .travis.yml | 4 +++- container-structure-config.yaml | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 container-structure-config.yaml diff --git a/.travis.yml b/.travis.yml index 5b5db2d..3362e71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,10 @@ services: before_install: - wget https://github.com/wagoodman/dive/releases/download/v0.7.2/dive_0.7.2_linux_amd64.deb - sudo apt install ./dive_0.7.2_linux_amd64.deb +- curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 && chmod +x container-structure-test-linux-amd64 && sudo mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test - docker build -t chefaustin/gem-jar:latest . - docker run -d --name gem-jar -p 9292:9292 -v $(pwd)/db:/root/.gemstash chefaustin/gem-jar:latest - +- script: - dive chefaustin/gem-jar:latest +- container-structure-test test --image chefaustin/gem-jar:latest --config ./container-structure-config.yaml diff --git a/container-structure-config.yaml b/container-structure-config.yaml new file mode 100644 index 0000000..ffd8292 --- /dev/null +++ b/container-structure-config.yaml @@ -0,0 +1,11 @@ +schemaVersion: '2.0.0' # Make sure to test the latest schema version + +fileExistenceTests: +- name: 'existence-Gemfile' + path: '/Gemfile' + shouldExist: true +- name: 'existence-config.yml' + path: '/config.yml' + shouldExist: true +- name: 'existence-docker_health.rb' + path: '/docker_health.rb' From b1fedd2b74f4e9ca517e7ff260fc0fa39883d257 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Thu, 9 May 2019 18:09:03 -0600 Subject: [PATCH 8/9] Cross off LICENSE --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9472ec1..51c738a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ No nonsense Gemstash instance thrown in a container, backed by sqlite3 and wrapp ## Getting started 1. `git clone https://github.com/chefaustin/gem-jar.git` <= Clone this repo 2. `cd gem-jar` <= Navigate into it -3. `docker run --name gem-jar -p 9292:9292 -v ../db:/root/.gemstash chefaustin/gem-jar:latest` <= Bring container up +3. `docker run -d --name gem-jar -p 9292:9292 -v ../db:/root/.gemstash chefaustin/gem-jar:latest` <= Bring container up 4. `resp_key=$(docker exec -it gem-jar gemstash authorize | cut -d ' ' -f 5)` <= Generate and grab a new API key 5. `mkdir -p ~/.gem; touch ~/.gem/credentials; echo ":gemstash: $resp_key"; chmod 0600 ~/.gem/credentials` <= Create and append key to `~/.gem/credentials` @@ -18,7 +18,7 @@ No nonsense Gemstash instance thrown in a container, backed by sqlite3 and wrapp - [Dockerspec](https://github.com/zuazo/dockerspec) - Fine-tune Docker `HEALTHCHECK` - Other: - - Figure out proper FOSS `LICENSE` + - ~~Figure out proper FOSS `LICENSE`~~ - Build out wiki - Functionality: - Move to docker-compose with containerized ingress From 371eb41c4a19af8821c56c8b1d42ac1f201ab101 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Thu, 9 May 2019 18:11:13 -0600 Subject: [PATCH 9/9] Pre-merge version bump --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5012c2e..70c2b1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ruby:2.6.2 LABEL maintainer="austinculter@gmail.com" -LABEL version="0.1.1" +LABEL version="0.1.2" COPY Gemfile* config.yml docker_health.rb / RUN bundle install --gemfile /Gemfile