Skip to content

Commit

Permalink
Update to install Js-Ecqm-Engine
Browse files Browse the repository at this point in the history
  • Loading branch information
giriraj0209 committed Jan 4, 2019
1 parent 4aa18f0 commit 460c724
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 340 deletions.
12 changes: 0 additions & 12 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
<%
# Use the runlist, attributes and other settings defined in node.json to
# ensure .kitchen.yml runs against the exact same configuration as Vagrantfile.
require 'json'
if !File.exist?('install_cypress_cvu.json')
puts 'Aborting .kitchen.yml: required install_cypress_cvu.json does not exist'
exit
else
node = JSON.parse(File.read('install_cypress_cvu.json'))
end
%>
---
driver:
name: vagrant
customize:
Expand Down
42 changes: 9 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
## About

This recipe is designed to make it easier to deploy cypress quickly.
This recipe is designed to make it easier to deploy RabbitMQ and Js-Ecqm-Engine quickly.

### What it doesn't do:
- It will not download and import the measure bundle (see section on Importing Measure Bundle below)
- It will not set up proxy settings
- Does not configure networking
- It will not download and install popHealth


## Installation Options
This recipe has been tested to work on Ubuntu 16.04 using the following install method:
Expand All @@ -14,38 +13,15 @@ This recipe has been tested to work on Ubuntu 16.04 using the following install

sudo apt-get update
sudo apt-get -y install git-core wget
wget https://packages.chef.io/files/stable/chefdk/1.5.0/ubuntu/16.04/chefdk_1.5.0-1_amd64.deb
sudo dpkg -i chefdk_1.5.0-1_amd64.deb
git clone https://github.com/projectcypress/cypress-recipe.git
cd cypress-recipe
wget https://packages.chef.io/files/stable/chefdk/2.0.26/ubuntu/16.04/chefdk_2.0.26-1_amd64.deb
sudo dpkg -i chefdk_2.0.26-1_amd64.deb
git clone https://github.com/giriraj0209/js-ecqm-engine-recipe.git
cd js-ecqm-engine-recipe
berks vendor cookbooks

You will now need to decide between whether you want to install cypress and the cypress validation utility, only cypress, or only the cypress validation utility.

To install Cypress + Cypress Validation Utility run

sudo chef-client -z -j install_cypress_cvu.json

To install Cypress only run

sudo chef-client -z -j install_cypress.json

To install the Cypress Validation Utility only run

sudo chef-client -z -j install_cvu.json

If you need to install both cypress and the cypress validation utility, make sure you run the first command, attempting to run the second and third installation commands in conjunction will not work properly.

Instructions for importing a bundle can be found [here](https://github.com/projectcypress/cypress/wiki/Cypress-4-Initial-Setup).

## Developing using Test Kitchen

If you wish to stand up a local copy of this recipe for testing, there is a test kitchen script included in this repository. If you have never installed test kitchen before, then you will need to do so along with downloading a few other tools. Please follow the steps below before running the `kitchen test` command from the directory you have this repository cloned into.
To install Js-Ecqm-Engine run

1. Install [Vagrant](http://www.vagrantup.com/downloads.html) ">= 1.5.2"
2. Install [Virtualbox](https://www.virtualbox.org/) ">= 4.3.14"
3. Install [ChefDK](https://downloads.chef.io/chefdk) ">= 0.2.0"
4. Run `bundle install` in the root of this repository.
sudo chef-client -z -j install_ecqmEngine.json

Once those steps are completed, you should be able to execute `bundle exec kitchen test` with no problems.

30 changes: 6 additions & 24 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,15 @@
# ATL Version (cypress only) ENV Vars
default[:cypress][:cypress_env_vars] =
default[:ecqmEngine][:ecqmEngine_env_vars] =
{
"AUTO_APPROVE" => "false",
"IGNORE_ROLES" => "false",
"ENABLE_DEBUG_FEATURES" => "false",
"DEFAULT_ROLE" => "",
}
default[:cypress][:cypress_internal_port] = 8000
# this is the path which Cypress will install itself to, this is not the
# place to configure it however! The Cypress package specifies itself
# where it will install to, so you will need to recompile to package
# to change it. The same applies to the cvu_install_path below.
default[:cypress][:cypress_install_path] = '/opt/cypress'
default[:cypress][:cvu_install_path] = '/opt/cypress-validation-utility'
default[:cypress][:js_ecqm_install_path] = '/opt/js-ecqm-engine'
default[:cypress][:cypress_repository] = 'https://dl.packager.io/srv/deb/projectcypress/cypress/cypress_v4/ubuntu'
default[:cypress][:cvu_repository] = 'https://dl.packager.io/srv/deb/projectcypress/cypress-validation-utility/cvu_v4/ubuntu'
default[:cypress][:js_ecqm_repository] = 'https://dl.packager.io/srv/deb/projectcypress/js-ecqm-engine/release/ubuntu'
default[:cypress][:cypress_repository_key] = 'https://dl.packager.io/srv/projectcypress/cypress/key'
default[:cypress][:cvu_repository_key] = 'https://dl.packager.io/srv/projectcypress/cypress-validation-utility/key'
default[:cypress][:js_ecqm_repository_key] = 'https://dl.packager.io/srv/projectcypress/js-ecqm-engine/key'
# Blank version means latest build, anything else will attempt to install
# a specific version from the repository.
default[:cypress][:cypress_version] = ''
default[:cypress][:cvu_version] = ''
default[:cypress][:js_ecqm_version] = ''
default[:cypress][:cvu_internal_port] = 8001
default[:cypress][:cvu_external_port] = 8080
default[:cypress][:generate_secrets_on_restart] = false

default[:ecqmEngine][:js_ecqm_install_path] = '/opt/js-ecqm-engine'
default[:ecqmEngine][:js_ecqm_repository] = 'https://dl.packager.io/srv/deb/giriraj0209/js-ecqm-engine/master/ubuntu'
default[:ecqmEngine][:js_ecqm_repository_key] = 'https://dl.packager.io/srv/giriraj0209/js-ecqm-engine/key'
default[:ecqmEngine][:js_ecqm_version] = ''

force_default['erlang']['install_method'] = "esl"
force_default['erlang']['esl']['version'] = "1:20.3.6"
2 changes: 1 addition & 1 deletion files/default/mongod.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ net:
port: 27017
bindIp: 127.0.0.1

# higher max bson depth is required for cypress + bonnie on mongo 3.4.4+
# higher max bson depth is required on mongo 3.4.4+
setParameter:
maxBSONDepth: 500
3 changes: 0 additions & 3 deletions install_cvu.json

This file was deleted.

3 changes: 0 additions & 3 deletions install_cypress.json

This file was deleted.

3 changes: 0 additions & 3 deletions install_cypress_cvu.json

This file was deleted.

3 changes: 3 additions & 0 deletions install_ecqmEngine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"run_list": [ "recipe[apt]", "recipe[ecqmEngine::install_ecqmEngine]" ]
}
8 changes: 4 additions & 4 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name 'cypress'
maintainer 'MITRE'
maintainer_email '[email protected]'
name 'ecqmEngine'
maintainer 'OSEHRA'
maintainer_email ''
license 'All rights reserved'
description 'Installs/Configures Cypress'
description 'Installs/Configures Js-ecqm-engine'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.0.0'
depends "apt", "~> 6.1"
Expand Down
55 changes: 4 additions & 51 deletions providers/install_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@

# Lock the version to whatever is installed by
# this Chef recipe in order to require the user
# to run the upgrade script to upgrade Cypress
# to run the upgrade script to upgrade ecqmEngine
# and also protect the user from accidently
# upgrading Cypress when they did not intend to
# upgrading ecqmEngine when they did not intend to
[ :install, :lock ].each do |install_action|
package new_resource.name do
action install_action
Expand All @@ -71,63 +71,16 @@
# Set all ENV variables passed in through the env_vars hash
# for the application
new_resource.env_vars.each do |key, value|
cypress_pkgr_env new_resource.name do
ecqmEngine_pkgr_env new_resource.name do
key key
value value
end
end

# Configure the port which the application should run on
cypress_pkgr_env new_resource.name do
key "PORT"
value new_resource.unicorn_port.to_s
only_if { new_resource.frontend_worker_count > 0 }
end

cypress_pkgr_env new_resource.name do
key "web"
value new_resource.frontend_worker_count.to_s
action :scale
end

cypress_pkgr_env new_resource.name do
ecqmEngine_pkgr_env new_resource.name do
key "worker"
value new_resource.delayed_job_count.to_s
action :scale
end

package 'nginx' do
action :install
only_if { new_resource.frontend_worker_count > 0 }
end

# Setup nginx configuration
template "/etc/nginx/sites-enabled/default" do
source "nginx.conf.erb"
mode "644"
variables({
:primary_app_path => install_path,
:primary_app_port => new_resource.unicorn_port,
:enable_secondary_app => false
})
only_if { new_resource.frontend_worker_count > 0 }
end

template '/etc/systemd/system/regenerate-secrets.service' do
source "regenerate-secrets.service.erb"
variables({
:service_names => [ new_resource.name ]
})
only_if { new_resource.generate_secrets_on_restart }
end

service "regenerate-secrets" do
action [:enable]
only_if { new_resource.generate_secrets_on_restart }
end

service "nginx" do
action :restart
only_if { new_resource.frontend_worker_count > 0 }
end
end
44 changes: 0 additions & 44 deletions recipes/default.rb

This file was deleted.

9 changes: 0 additions & 9 deletions recipes/install_cvu.rb

This file was deleted.

26 changes: 0 additions & 26 deletions recipes/install_cypress.rb

This file was deleted.

14 changes: 14 additions & 0 deletions recipes/install_ecqmEngine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
include_recipe 'rabbitmq'

ecqmEngine_install_app 'js-ecqm-engine' do
application_path node[:ecqmEngine][:js_ecqm_install_path]
application_version node[:ecqmEngine][:js_ecqm_version]
repository node[:ecqmEngine][:js_ecqm_repository]
repository_key node[:ecqmEngine][:js_ecqm_repository_key]
end

# This is necessary due to https://github.com/rabbitmq/chef-cookbook/commit/c7a37ccfcfe2444d0ff8f567c33da0be055357f8
package 'esl-erlang' do
action :lock
version node['erlang']['esl']['version']
end
7 changes: 0 additions & 7 deletions resources/install_app.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
default_action :create

attribute :name, :kind_of => String
attribute :unicorn_port, :kind_of => Integer, :default => 8000
attribute :repository, :kind_of => String
attribute :repository_key, :kind_of => String
attribute :application_path, :kind_of => String
attribute :application_version, :kind_of => String
# Set app to run with 1 frontend unicorn worker. Note that
# any setting inside of config/unicorn.rb in the application is
# still respected to 1 web worker is actually 1 web worker with
# 4 worker processes if worker_processes is set to 4, for example.
attribute :frontend_worker_count, :kind_of => Integer, :default => 1
attribute :delayed_job_count, :kind_of => Integer, :default => 3
attribute :env_vars, :kind_of => Hash, :default => {}
attribute :generate_secrets_on_restart, :kind_of => [TrueClass, FalseClass], :default => false
18 changes: 0 additions & 18 deletions templates/default/delayed_worker_systemd.conf.erb

This file was deleted.

Loading

0 comments on commit 460c724

Please sign in to comment.