vagrant-qienv 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +49 -0
  6. data/Gemfile +10 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +94 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/lib/envs/default.json +20 -0
  13. data/lib/envs/linux-desktop.json +22 -0
  14. data/lib/envs/production.yml +33 -0
  15. data/lib/provisioning/base-playbook.yml +16 -0
  16. data/lib/provisioning/couchdb-playbook.yml +11 -0
  17. data/lib/provisioning/couchdb-requirements.yml +5 -0
  18. data/lib/provisioning/couchdb-vagrant-vars.yml +1 -0
  19. data/lib/provisioning/gpii-linux-playbook.yml +11 -0
  20. data/lib/provisioning/gpii-linux-requirements.yml +6 -0
  21. data/lib/provisioning/gpii-linux-vagrant-vars.yml +23 -0
  22. data/lib/provisioning/nodejs-playbook.yml +12 -0
  23. data/lib/provisioning/nodejs-requirements.yml +7 -0
  24. data/lib/provisioning/nodejs-vagrant-vars.yml +11 -0
  25. data/lib/provisioning/preferences-playbook.yml +13 -0
  26. data/lib/provisioning/preferences-requirements.yml +9 -0
  27. data/lib/provisioning/preferences-vagrant-vars.yml +5 -0
  28. data/lib/vagrant-qienv.rb +18 -0
  29. data/lib/vagrant-qienv/action.rb +122 -0
  30. data/lib/vagrant-qienv/action/init_environment.rb +24 -0
  31. data/lib/vagrant-qienv/command/base.rb +19 -0
  32. data/lib/vagrant-qienv/command/init.rb +28 -0
  33. data/lib/vagrant-qienv/command/test.rb +65 -0
  34. data/lib/vagrant-qienv/config/config_folders.rb +17 -0
  35. data/lib/vagrant-qienv/config/config_network.rb +69 -0
  36. data/lib/vagrant-qienv/config/config_provider.rb +40 -0
  37. data/lib/vagrant-qienv/config/config_provision.rb +50 -0
  38. data/lib/vagrant-qienv/plugin.rb +59 -0
  39. data/lib/vagrant-qienv/version.rb +5 -0
  40. data/qi.yml.template +56 -0
  41. data/samples/README.md +12 -0
  42. data/samples/gpii-linux-production/.qi.yml +41 -0
  43. data/samples/gpii-linux/.qi.yml +22 -0
  44. data/samples/gpii-nexus/.qi.yml +24 -0
  45. data/samples/gpii-universal/.qi.yml +27 -0
  46. data/spec/spec_helper.rb +2 -0
  47. data/spec/vagrant/cienv_spec.rb +11 -0
  48. data/vagrant-cienv.gemspec +33 -0
  49. metadata +137 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4d7ba2fcb9e9659682a1fd8609b5bb021f1c0a8c
4
+ data.tar.gz: e7faeac2ac7487d634ab836a6b03c0a9f2d4624b
5
+ SHA512:
6
+ metadata.gz: 1492f43cb21f42fddae2807ba064e41849aef9dfa7b3c437d64d3067a896114c15bd469184fcd08faf45533628140b0fa95db31bd6afec22801a26db99eb8065
7
+ data.tar.gz: 96e880b232e4f610cf5625d0f01f509e3d9abe47ba4c3652f8bb087b2128b0aed66abff732cd073e6140c6e1e5bda6c61b6df01b4ac488c77ae6741832e95255
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .vagrant
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.4
4
+ before_install: gem install bundler -v 1.11.2
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at amatas@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
5
+ gem "vagrant-spec", git: "https://github.com/mitchellh/vagrant-spec.git"
6
+ end
7
+
8
+ group :plugins do
9
+ gemspec
10
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Alfredo Matas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,94 @@
1
+ Vagrant-vmenv
2
+ =============
3
+
4
+ Vagrant-vmenv is a npm module that is used to extend the behavior of a
5
+ Vagrantfile. It uses virtual machine definitions to spin up complete
6
+ enviroments where you can run tests or run your code.
7
+
8
+ Installation
9
+ ------------
10
+
11
+ ```
12
+ npm install -g http://github.com/amatas/vagrant-vmenv
13
+ cp node_modules/vagrant-vmenv/Vagrantfile.template Vagrantfile
14
+ cp node_modules/vagrant-vmenv/qi.yml.template .qi.yml
15
+ ```
16
+
17
+ The Vagrantfile acts as a pointer to the module, it shouldn't be modified. If
18
+ you want to make a change at the environment level do so in the [environment
19
+ configuration file](envs/), and if you want to configure how the applications
20
+ are deployed and tested do so in the [.qi.yml](qi.yml.template) file of your
21
+ repository.
22
+
23
+ Working with vms
24
+ ----------------
25
+
26
+ Commands:
27
+
28
+ * `vagrant up` to spin up the [environment](envs/) defined in the .qi.yml file.
29
+ * `vagrant destroy` to stop and destroy the vm.
30
+ * `vagrant halt` to shutdown the vm without destroy it.
31
+
32
+ Note:
33
+
34
+ * `vagrant up` will exec the commands listed in the *setup* variable of each
35
+ application listed in the .qi.yml file.
36
+ * `vagrant provision` will exec the commands listed in the *test_cmds* variable
37
+ of each application listed in the .qi.yml file.
38
+
39
+ Networking
40
+ ----------
41
+
42
+ A VM can have multiple virtual NICs. Two types are avilable for each NIC: public
43
+ and private. The public NICs will be attached to the host's physical network,
44
+ the private NICs will be attached to a private network only visible between the
45
+ other VMs and the host. The IP address of a private network can be customized in
46
+ the definition of the VM. An example of the network definition of a VM can be:
47
+
48
+ ```
49
+ networks:
50
+ privatenet:
51
+ type: private
52
+ ip: 192.168.45.22
53
+ publicnet:
54
+ type: public
55
+ ```
56
+
57
+ If an environment has multiple VMs definitions with several NICs the *hosts*
58
+ file of each VM will list all the IP address of each VM plus the name of the VM,
59
+ this is very useful to point services between the VMs.
60
+
61
+ Forwarded ports
62
+ ---------------
63
+
64
+ The port forwarding is configured in the VMs definition. The `guest_port`
65
+ variable is the source port to be mapped to the `host_port` variable. The
66
+ `guest_port` must be set in each port forward block, `host_port` and protocol are
67
+ optionals.
68
+
69
+ ```
70
+ ports:
71
+ - guest_port: 8080
72
+ host_port: 8888
73
+ protocol: tcp
74
+ - guest_port: 8181
75
+ host_port: 9999
76
+ - guest_port:8081
77
+ ```
78
+
79
+ Shared folders
80
+ --------------
81
+
82
+ Each application can use a shared folder. If the *folder* variable of the
83
+ application has a *src* key, Vagrant will map the path set in the src folder of
84
+ the host to the path set in the *dest* variable in the VM.
85
+
86
+ ```
87
+ folder:
88
+ src: "."
89
+ dest: "/app/universal"
90
+ ```
91
+
92
+ More samples definitions can be found either in the [envs](envs) directory or in
93
+ the [qi.yml.template](qi.yml.template).
94
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "vagrant/cienv"
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
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,20 @@
1
+ {
2
+ "global": {
3
+ "provider": "virtualbox",
4
+ "cpu": 2,
5
+ "memory": 1024
6
+ },
7
+ "vms": {
8
+ "fedora": {
9
+ "autostart": true,
10
+ "box": "inclusivedesign/centos7",
11
+ "folders": {
12
+ "code": {
13
+ "src": ".",
14
+ "dest": "/home/vagrant/sync"
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
20
+
@@ -0,0 +1,22 @@
1
+ {
2
+ "global": {
3
+ "provider": "virtualbox",
4
+ "cpu": 2,
5
+ "memory": 1024
6
+ },
7
+ "vms": {
8
+ "fedora": {
9
+ "autostart": true,
10
+ "box": "inclusivedesign/fedora24",
11
+ "gui": true,
12
+ "sound": true,
13
+ "folders": {
14
+ "code": {
15
+ "src": ".",
16
+ "dest": "/home/vagrant/sync"
17
+ }
18
+ }
19
+ }
20
+ }
21
+ }
22
+
@@ -0,0 +1,33 @@
1
+ ---
2
+
3
+ global:
4
+ provider: virtualbox
5
+ cpu: 2
6
+ memory: 1024
7
+ vms:
8
+ server:
9
+ autostart: true
10
+ box: inclusivedesign/centos7
11
+ gui: false
12
+ networks:
13
+ private:
14
+ type: private
15
+ folders:
16
+ code:
17
+ src: "."
18
+ dest: "/home/vagrant/sync/node_modules/universal"
19
+ fedora:
20
+ autostart: true
21
+ box: inclusivedesign/fedora24
22
+ gui: true
23
+ sound: true
24
+ cpu: 4
25
+ memory: 2048
26
+ networks:
27
+ private:
28
+ type: private
29
+ folders:
30
+ code:
31
+ src: "."
32
+ dest: "/home/vagrant/sync/node_modules/universal"
33
+
@@ -0,0 +1,16 @@
1
+ ---
2
+
3
+ - hosts: localhost
4
+ become: true
5
+
6
+ pre_tasks:
7
+ - name: Set hostname
8
+ hostname: "name={{ lookup('env', 'VM_HOSTNAME') }}"
9
+
10
+ - name: "Build hosts file"
11
+ lineinfile:
12
+ dest: /etc/hosts
13
+ line: "{{ item.key }} {{ item.value }}"
14
+ state: present
15
+ with_dict: "{{ vms_hosts|default({}) }}"
16
+
@@ -0,0 +1,11 @@
1
+ ---
2
+
3
+ - hosts: localhost
4
+ become: true
5
+
6
+ vars_files:
7
+ - "{{ lookup('env', 'VARS_FILE') }}"
8
+
9
+ roles:
10
+ - facts
11
+ - couchdb
@@ -0,0 +1,5 @@
1
+ - src: http://github.com/idi-ops/ansible-couchdb.git
2
+ name: couchdb
3
+
4
+ - src: http://github.com/idi-ops/ansible-facts.git
5
+ name: facts
@@ -0,0 +1 @@
1
+ ---
@@ -0,0 +1,11 @@
1
+ ---
2
+
3
+ - hosts: localhost
4
+ become: true
5
+
6
+ vars_files:
7
+ - "{{ lookup('env', 'VARS_FILE') }}"
8
+
9
+ roles:
10
+ - facts
11
+ - nodejs
@@ -0,0 +1,6 @@
1
+ - src: http://github.com/idi-ops/ansible-facts.git
2
+ name: facts
3
+
4
+ - src: http://github.com/amatas/ansible-nodejs.git
5
+ version: test-vagrant-venv
6
+ name: nodejs
@@ -0,0 +1,23 @@
1
+ ---
2
+
3
+ nodejs_npm_packages:
4
+ - "@development-tools"
5
+ - orca
6
+ - glib2-devel
7
+ - PackageKit-glib-devel
8
+ - json-glib-devel
9
+ - libXrandr-devel
10
+ - libXrender-devel
11
+ - libX11-devel
12
+ - xorg-x11-proto-devel
13
+ - alsa-lib-devel
14
+ - tuxguitar
15
+ nodejs_app_name: "{{ app_name | default('application') }}"
16
+ #nodejs_version: "{{ software_stack_version }}"
17
+ nodejs_app_commands: "{{ setup | default([]) }}"
18
+ #nodejs_app_start_script: "{{ app_start_script }}"
19
+ #nodejs_app_tcp_port: "{{ app_tcp_port }}"
20
+ #nodejs_app_git_clone: false
21
+ nodejs_app_git_repo: "{{ git_repository | default(false) }}"
22
+ nodejs_app_git_branch: "{{ git_branch | default('master') }}"
23
+ nodejs_app_install_dir: "{{ folder['dest'] }}"
@@ -0,0 +1,12 @@
1
+ ---
2
+
3
+ - hosts: localhost
4
+ become: true
5
+
6
+ vars_files:
7
+ - "{{ lookup('env', 'VARS_FILE') }}"
8
+
9
+ roles:
10
+ - facts
11
+ - nodejs
12
+
@@ -0,0 +1,7 @@
1
+ - src: http://github.com/idi-ops/ansible-facts.git
2
+ name: facts
3
+
4
+ - src: https://github.com/amatas/ansible-nodejs.git
5
+ version: test-vagrant-venv
6
+ name: nodejs
7
+
@@ -0,0 +1,11 @@
1
+ ---
2
+
3
+ nodejs_app_name: "{{ app_name | default('application') }}"
4
+ #nodejs_version: "{{ software_stack_version }}"
5
+ nodejs_app_commands: "{{ setup | default([]) }}"
6
+ #nodejs_app_start_script: "{{ app_start_script }}"
7
+ #nodejs_app_tcp_port: "{{ app_tcp_port }}"
8
+ #nodejs_app_git_clone: false
9
+ nodejs_app_git_repo: "{{ git_repository | default(false) }}"
10
+ nodejs_app_git_branch: "{{ git_branch | default('master') }}"
11
+ nodejs_app_install_dir: "{{ folder['dest'] }}"