katar 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +148 -0
- data/Rakefile +2 -0
- data/Vagrantfile +40 -0
- data/bin/katar +6 -0
- data/katar.gemspec +26 -0
- data/lib/katar/cli.rb +3 -0
- data/lib/katar/commands/application.rb +88 -0
- data/lib/katar/commands/edit_command.rb +28 -0
- data/lib/katar/commands/init_command.rb +28 -0
- data/lib/katar/globals.rb +3 -0
- data/lib/katar/vagrant.rb +145 -0
- data/lib/katar/version.rb +3 -0
- data/lib/katar.rb +5 -0
- data/lib/scripts/clear-variables.sh +3 -0
- data/lib/stubs/Katar.yaml +39 -0
- data/lib/stubs/after.sh +5 -0
- data/lib/stubs/aliases +7 -0
- data/lib/stubs/sshconfig +1 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6df886197ee378c1d6793ab16397c1ceaa76ea2b
|
4
|
+
data.tar.gz: 39482861ca6a4865519f82c26cf0384110428e28
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea9c90fbcb41e1d4d4e4497a1ee012981a9cecfbf9ad2de3458edeb2a02632020324c3e30b0e6a7b9c6430c958852f91306fab685786149757a4e2b29b765104
|
7
|
+
data.tar.gz: aff27ee622cf994e27999bfdb26c75da08e90b766be4154fd2d2488e51041d1d20192743584bd6b84e4ca07bcd513ca8471bdbcb0df5542ec1462d284fec9d71
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 AcMitch
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
Katar provides a simple, elegant way to manage and provision a Vagrant box on your local machine! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in seconds!
|
2
|
+
|
3
|
+
**Note: Katar is inspired by PHP's [Laravel Homestead](https://laravel.com/docs/5.2/homestead) but with broader scope and without PHP dependencies. If developing web applications or in PHP [Laravel Homestead](https://laravel.com/docs/5.2/homestead) is highly recommended.**
|
4
|
+
|
5
|
+
Katar runs on any Windows, Mac, or Linux system, and by default uses a Vagrant box with almost everything you need to develop most applications.
|
6
|
+
|
7
|
+
### Installing VirtualBox & Vagrant
|
8
|
+
|
9
|
+
Before launching your Katar environment, you must install VirtualBox and Vagrant. Both of these software packages provide easy-to-use visual installers for all popular operating systems.
|
10
|
+
|
11
|
+
**Note: If you are using Windows, you may need to enable hardware virtualization (VT-x). It can usually be enabled via your BIOS.**
|
12
|
+
|
13
|
+
### Installing Katar
|
14
|
+
|
15
|
+
Katar is a Ruby Gem, therefore, Ruby must be installed on your local machine. Once Ruby is installed simply run the following command to install Katar:
|
16
|
+
|
17
|
+
```
|
18
|
+
gem install katar
|
19
|
+
```
|
20
|
+
|
21
|
+
Once you have installed the Katar Gem, run the `init command` to create the Katar.yaml configuration file:
|
22
|
+
|
23
|
+
```
|
24
|
+
katar init
|
25
|
+
```
|
26
|
+
|
27
|
+
The Katar.yaml file will be placed in the ~/.katar directory. If you're using a Mac or Linux system, you may edit Katar.yaml file by running the `katar edit` command in your terminal:
|
28
|
+
|
29
|
+
```
|
30
|
+
katar edit
|
31
|
+
```
|
32
|
+
|
33
|
+
If you would like to do some extra provisioning you may add any commands you wish to the `after.sh` file within the ~/.katar directory and they will be run after the Katar machine is provisioned.
|
34
|
+
|
35
|
+
### Setting Your Box
|
36
|
+
|
37
|
+
The `box` property of the Katar.yaml file is the Vagrant box that will be utilized by your Katar environment. If no box is provided then `ubuntu\wily64` will be created.
|
38
|
+
|
39
|
+
**Note: Mysql and Postgres scripts run if a database is provided within the Katar.yaml file. Those database engines must be installed on the specified box for Katar to initialize properly. Simply comment out the database section within the Katar.yaml and configure the database manually if needing to run without those engines.**
|
40
|
+
|
41
|
+
By default the `box` property is set to `acmitch/katar-box`. Included with that box is the following software:
|
42
|
+
|
43
|
+
##### Included Software
|
44
|
+
- Ubuntu 15.10
|
45
|
+
- Docker 1.10
|
46
|
+
- Git
|
47
|
+
- Subversion
|
48
|
+
- Java 8
|
49
|
+
- Python 2.7.10
|
50
|
+
- Ruby 2.2.3 (RVM)
|
51
|
+
- R
|
52
|
+
- MySQL
|
53
|
+
- Sqlite3
|
54
|
+
- Postgres
|
55
|
+
- NodeJs(With PM2, Browserify, Bower, Grunt, and Gulp)
|
56
|
+
- Redis
|
57
|
+
- Memcached
|
58
|
+
|
59
|
+
#### Included Applications
|
60
|
+
- Xfce4 Desktop
|
61
|
+
- Sublime Text 3
|
62
|
+
- Terminator
|
63
|
+
- Emacs
|
64
|
+
- Vim
|
65
|
+
|
66
|
+
**Note: If wishing to contribute clone `acmitch/katar-box` on GitHub.**
|
67
|
+
|
68
|
+
### Configuring Shared Folders
|
69
|
+
|
70
|
+
The folders property of the Katar.yaml file lists all of the folders you wish to share with your Katar environment. As files within these folders are changed, they will be kept in sync between your local machine and the Katar environment. You may configure as many shared folders as necessary:
|
71
|
+
|
72
|
+
```
|
73
|
+
folders:
|
74
|
+
- map: ~/Workspace
|
75
|
+
to: /home/vagrant/Workspace
|
76
|
+
```
|
77
|
+
|
78
|
+
### Set Your SSH Key
|
79
|
+
|
80
|
+
Next, you should edit the Katar.yaml file. In this file, you can configure the path to your public SSH key, as well as the folders you wish to be shared between your main machine and the Katar virtual machine.
|
81
|
+
|
82
|
+
**Don't have an SSH key? On Mac and Linux, you can generally create an SSH key pair using the following command:**
|
83
|
+
|
84
|
+
```
|
85
|
+
ssh-keygen -t rsa -C "you@katar"
|
86
|
+
```
|
87
|
+
|
88
|
+
On Windows, you may install Git and use the Git Bash shell included with Git to issue the command above. Alternatively, you may use PuTTY and PuTTYgen.
|
89
|
+
|
90
|
+
Once you have created a SSH key, specify the key's path in the authorize property of your Katar.yaml file.
|
91
|
+
|
92
|
+
### Launch The Vagrant Box
|
93
|
+
|
94
|
+
Once you have edited the Katar.yaml to your liking, run the `katar up` command in your terminal.
|
95
|
+
|
96
|
+
Vagrant will boot the virtual machine, and configure your shared folders! To destroy the machine, you may use the `katar destroy` command. For a complete list of available Katar commands, run `katar help`.
|
97
|
+
|
98
|
+
```
|
99
|
+
Commands:
|
100
|
+
katar destroy # Destroy the Katar machine
|
101
|
+
katar edit # Edit the Katar.yaml file
|
102
|
+
katar halt # Halt the Katar machine
|
103
|
+
katar help [COMMAND] # D``escribe available commands or one specific command
|
104
|
+
katar init # Create a stub Katar.yaml file
|
105
|
+
katar provision # Re-provisions the Katar machine
|
106
|
+
katar provision # Update the Katar machine image
|
107
|
+
katar resume # Resume the suspended Katar machine
|
108
|
+
katar ssh # Login to the Katar machine via SSH
|
109
|
+
katar status # Get the status of the Katar machine
|
110
|
+
katar suspend # Suspend the Katar machine
|
111
|
+
katar up # Start the Katar machine
|
112
|
+
katar version # Show Katar version number
|
113
|
+
```
|
114
|
+
|
115
|
+
### Connecting To Your Databases
|
116
|
+
|
117
|
+
A `katar` database is configured for both MySQL and Postgres out of the box. You can add as many databases as you'd like by typing the `katar edit` command and editing the `databases` section of the Katar.yaml file. The username and password for all databases is `root` / `secret`.
|
118
|
+
|
119
|
+
### Ports
|
120
|
+
|
121
|
+
By default, the following ports are forwarded to your Katar environment:
|
122
|
+
|
123
|
+
```
|
124
|
+
SSH: 2222 → Forwards To 22
|
125
|
+
HTTP: 8000 → Forwards To 80
|
126
|
+
HTTPS: 44300 → Forwards To 443
|
127
|
+
MySQL: 33060 → Forwards To 3306
|
128
|
+
Postgres: 54320 → Forwards To 5432
|
129
|
+
Forwarding Additional Ports
|
130
|
+
```
|
131
|
+
|
132
|
+
If you wish, you may forward additional ports to the Vagrant box, as well as specify their protocol:
|
133
|
+
|
134
|
+
```
|
135
|
+
ports:
|
136
|
+
- send: 93000
|
137
|
+
to: 9300
|
138
|
+
- send: 7777
|
139
|
+
to: 777
|
140
|
+
protocol: udp
|
141
|
+
```
|
142
|
+
### Desktop Mode
|
143
|
+
|
144
|
+
By default, VirtualBox machines are started in headless mode, meaning there is no UI for the machines visible on the host machine. To utilize the UI set the `desktop` property to true in the Katar.yaml file. During the boot process VirtualBox will open prompting login. When the boot processes finishes, simply login using the credentials `vagrant`/`vagrant`. Once logged in start the GUI by typing into the prompt:
|
145
|
+
|
146
|
+
```
|
147
|
+
xfce4-desktop
|
148
|
+
```
|
data/Rakefile
ADDED
data/Vagrantfile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
VAGRANTFILE_API_VERSION = "2"
|
5
|
+
confDir = $confDir ||= File.expand_path("~/.katar")
|
6
|
+
|
7
|
+
katarYamlPath = confDir + "/Katar.yaml"
|
8
|
+
katarJsonPath = confDir + "/Katar.json"
|
9
|
+
afterScriptPath = confDir + "/after.sh"
|
10
|
+
sshconfigPath = confDir + "/sshconfig"
|
11
|
+
aliasesPath = confDir + "/aliases"
|
12
|
+
|
13
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/katar/vagrant.rb')
|
14
|
+
|
15
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
16
|
+
|
17
|
+
if File.exists? aliasesPath then
|
18
|
+
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
|
19
|
+
end
|
20
|
+
|
21
|
+
if File.exists? sshconfigPath then
|
22
|
+
config.vm.provision "file", source: sshconfigPath, destination: "~/.ssh/config"
|
23
|
+
end
|
24
|
+
|
25
|
+
# Read configuration
|
26
|
+
if File.exists? katarYamlPath then
|
27
|
+
settings = YAML::load(File.read(katarYamlPath))
|
28
|
+
elsif File.exists? katarJsonPath then
|
29
|
+
settings = JSON.parse(File.read(katarJsonPath))
|
30
|
+
end
|
31
|
+
|
32
|
+
# Setup/Start up VM
|
33
|
+
Katar.configure(config, settings)
|
34
|
+
|
35
|
+
# Provision using custom shell script
|
36
|
+
if File.exists? afterScriptPath then
|
37
|
+
config.vm.provision "shell", path: afterScriptPath
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/bin/katar
ADDED
data/katar.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'katar/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "katar"
|
8
|
+
spec.version = Katar::VERSION
|
9
|
+
spec.authors = ["AcMitch"]
|
10
|
+
spec.email = ["adam.cameron.mitchell@gmail.com"]
|
11
|
+
spec.summary = "Katar provides a simple, elegant way to manage and provision a Vagrant box on your local machine."
|
12
|
+
spec.description = "Katar provides a simple, elegant way to manage and provision a Vagrant box on your local machine."
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = ["katar"]
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency 'rspec', '~> 3.3', '>= 3.3.0'
|
22
|
+
spec.add_runtime_dependency 'rubyzip', '~> 1.1', '>= 1.1.7'
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_dependency "thor", "~> 0.19.1"
|
26
|
+
end
|
data/lib/katar/cli.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
require "katar/globals"
|
2
|
+
require "katar/version"
|
3
|
+
require "thor"
|
4
|
+
|
5
|
+
module Katar
|
6
|
+
module Commands
|
7
|
+
class Application < Thor
|
8
|
+
|
9
|
+
desc "version", "Show Katar version number"
|
10
|
+
def version
|
11
|
+
puts Katar::VERSION
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "init", "Create a stub Katar.yaml file"
|
15
|
+
def init
|
16
|
+
require_command!("init_command")
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "edit", "Edit the Katar.yaml file"
|
20
|
+
def edit
|
21
|
+
require_command!("edit_command")
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "up", "Start the Katar machine"
|
25
|
+
def up
|
26
|
+
run_command "vagrant up"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "ssh", "Login to the Katar machine via SSH"
|
30
|
+
def ssh
|
31
|
+
run_command "vagrant ssh"
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "suspend", "Suspend the Katar machine"
|
35
|
+
def suspend
|
36
|
+
run_command "vagrant suspend"
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "resume", "Resume the suspended Katar machine"
|
40
|
+
def resume
|
41
|
+
run_command "vagrant resume"
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "reload", "Reload the Katar machine image"
|
45
|
+
def reload
|
46
|
+
run_command "vagrant reload"
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "destroy", "Destroy the Katar machine"
|
50
|
+
def destroy
|
51
|
+
run_command "vagrant destroy"
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "status", "Get the status of the Katar machine"
|
55
|
+
def status
|
56
|
+
run_command "vagrant status"
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "halt", "Halt the Katar machine"
|
60
|
+
def halt
|
61
|
+
run_command "vagrant halt"
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "provision", "Re-provisions the Katar machine"
|
65
|
+
def provision
|
66
|
+
run_command "vagrant provision"
|
67
|
+
end
|
68
|
+
|
69
|
+
desc "update", "Update the Katar machine image"
|
70
|
+
def update
|
71
|
+
run_command "vagrant box update"
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def run_command(command)
|
77
|
+
Dir.chdir( File.join(File.dirname(__FILE__), '../../../') ){
|
78
|
+
exec command
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
def require_command!(command)
|
83
|
+
require "katar/commands/#{command}"
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Katar
|
4
|
+
module Commands
|
5
|
+
class EditCommand < Thor
|
6
|
+
|
7
|
+
desc "edit", "Edit the Katar.yaml file"
|
8
|
+
def edit
|
9
|
+
|
10
|
+
if windows?
|
11
|
+
exec "start #{Katar::DIR}/Katar.yaml"
|
12
|
+
end
|
13
|
+
|
14
|
+
exec "open #{Katar::DIR}/Katar.yaml"
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def windows?
|
21
|
+
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Katar::Commands::EditCommand.start(ARGV)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require "thor"
|
3
|
+
|
4
|
+
module Katar
|
5
|
+
module Commands
|
6
|
+
class InitCommand < Thor
|
7
|
+
|
8
|
+
desc "init", "Create a stub Katar.yaml file"
|
9
|
+
def init
|
10
|
+
create_directory and copy_stubs
|
11
|
+
puts "Katar initialized!"
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def create_directory
|
17
|
+
Dir.mkdir Katar::DIR if ! Dir.exists? Katar::DIR
|
18
|
+
end
|
19
|
+
|
20
|
+
def copy_stubs
|
21
|
+
FileUtils.cp_r File.expand_path('../../../stubs', __FILE__) + "/.", Katar::DIR
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Katar::Commands::InitCommand.start(ARGV)
|
@@ -0,0 +1,145 @@
|
|
1
|
+
module Katar
|
2
|
+
def Katar.configure(config, settings)
|
3
|
+
# Set The VM Provider
|
4
|
+
ENV['VAGRANT_DEFAULT_PROVIDER'] = settings["provider"] = "virtualbox"
|
5
|
+
|
6
|
+
# Configure Local Variable To Access Scripts From Remote Location
|
7
|
+
scriptDir = File.expand_path('../../scripts', __FILE__)
|
8
|
+
|
9
|
+
# Prevent TTY Errors
|
10
|
+
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
|
11
|
+
|
12
|
+
# Allow SSH Agent Forward from The Box
|
13
|
+
config.ssh.forward_agent = true
|
14
|
+
|
15
|
+
# Configure The Box
|
16
|
+
config.vm.box = settings["box"] ||= "acmitch/katar-box"
|
17
|
+
config.vm.box_version = settings["version"] ||= ">= 0"
|
18
|
+
config.vm.hostname = settings["hostname"] ||= "katar"
|
19
|
+
|
20
|
+
# Configure A Private Network IP
|
21
|
+
config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.11"
|
22
|
+
|
23
|
+
# Configure A Few VirtualBox Settings
|
24
|
+
config.vm.provider "virtualbox" do |vb|
|
25
|
+
vb.name = settings["name"] ||= "katar"
|
26
|
+
vb.gui = settings["desktop"] ||= false
|
27
|
+
vb.customize ["modifyvm", :id, "--memory", settings["memory"] ||= "2048"]
|
28
|
+
vb.customize ["modifyvm", :id, "--cpus", settings["cpus"] ||= "1"]
|
29
|
+
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
|
30
|
+
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
31
|
+
vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
|
32
|
+
vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
|
33
|
+
end
|
34
|
+
|
35
|
+
# Configure A Few Parallels Settings
|
36
|
+
config.vm.provider "parallels" do |v|
|
37
|
+
v.update_guest_tools = true
|
38
|
+
v.memory = settings["memory"] ||= 2048
|
39
|
+
v.cpus = settings["cpus"] ||= 1
|
40
|
+
end
|
41
|
+
|
42
|
+
# Configure Proxies
|
43
|
+
if settings.include? "proxies"
|
44
|
+
if !Vagrant.has_plugin?("vagrant-proxyconf")
|
45
|
+
system('vagrant plugin install vagrant-proxyconf')
|
46
|
+
raise("vagrant-proxyconf installed. Run command again.");
|
47
|
+
end
|
48
|
+
|
49
|
+
settings["proxies"].each do |proxy|
|
50
|
+
# Environment and package managers
|
51
|
+
config.proxy.http = proxy["http"] ||= nil
|
52
|
+
config.proxy.https = proxy["https"] ||= nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Standardize Ports Naming Schema
|
57
|
+
if (settings.has_key?("ports"))
|
58
|
+
settings["ports"].each do |port|
|
59
|
+
port["guest"] ||= port["to"]
|
60
|
+
port["host"] ||= port["send"]
|
61
|
+
port["protocol"] ||= "tcp"
|
62
|
+
end
|
63
|
+
else
|
64
|
+
settings["ports"] = []
|
65
|
+
end
|
66
|
+
|
67
|
+
# Default Port Forwarding
|
68
|
+
default_ports = {
|
69
|
+
80 => 8000,
|
70
|
+
443 => 44300,
|
71
|
+
3306 => 33060,
|
72
|
+
5432 => 54320
|
73
|
+
}
|
74
|
+
|
75
|
+
# Use Default Port Forwarding Unless Overridden
|
76
|
+
default_ports.each do |guest, host|
|
77
|
+
unless settings["ports"].any? { |mapping| mapping["guest"] == guest }
|
78
|
+
config.vm.network "forwarded_port", guest: guest, host: host, auto_correct: true
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Add Custom Ports From Configuration
|
83
|
+
if settings.has_key?("ports")
|
84
|
+
settings["ports"].each do |port|
|
85
|
+
config.vm.network "forwarded_port", guest: port["guest"], host: port["host"], protocol: port["protocol"], auto_correct: true
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Configure The Public Key For SSH Access
|
90
|
+
if settings.include? 'authorize'
|
91
|
+
if File.exists? File.expand_path(settings["authorize"])
|
92
|
+
config.vm.provision "shell" do |s|
|
93
|
+
s.inline = "echo $1 | grep -xq \"$1\" /home/vagrant/.ssh/authorized_keys || echo $1 | tee -a /home/vagrant/.ssh/authorized_keys"
|
94
|
+
s.args = [File.read(File.expand_path(settings["authorize"]))]
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# Copy The SSH Private Keys To The Box
|
100
|
+
if settings.include? 'keys'
|
101
|
+
settings["keys"].each do |key|
|
102
|
+
config.vm.provision "shell" do |s|
|
103
|
+
s.privileged = false
|
104
|
+
s.inline = "echo \"$1\" > /home/vagrant/.ssh/$2 && chmod 600 /home/vagrant/.ssh/$2"
|
105
|
+
s.args = [File.read(File.expand_path(key)), key.split('/').last]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Register All Of The Configured Shared Folders
|
111
|
+
if settings.include? 'folders'
|
112
|
+
settings["folders"].each do |folder|
|
113
|
+
|
114
|
+
if (folder["type"] == "nfs")
|
115
|
+
mount_opts = folder["mount_options"] ? folder["mount_options"] : ['actimeo=1']
|
116
|
+
else
|
117
|
+
mount_opts = folder["mount_options"] ? folder["mount_options"] : []
|
118
|
+
end
|
119
|
+
|
120
|
+
# For b/w compatibility keep separate 'mount_opts', but merge with options
|
121
|
+
options = (folder["options"] || {}).merge({ mount_options: mount_opts })
|
122
|
+
|
123
|
+
# Double-splat (**) operator only works with symbol keys, so convert
|
124
|
+
options.keys.each{|k| options[k.to_sym] = options.delete(k) }
|
125
|
+
|
126
|
+
config.vm.synced_folder folder["map"], folder["to"], type: folder["type"] ||= nil, **options
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Configure All Of The Server Environment Variables
|
131
|
+
config.vm.provision "shell" do |s|
|
132
|
+
s.path = scriptDir + "/clear-variables.sh"
|
133
|
+
end
|
134
|
+
|
135
|
+
if settings.has_key?("variables")
|
136
|
+
settings["variables"].each do |var|
|
137
|
+
config.vm.provision "shell" do |s|
|
138
|
+
s.inline = "echo \"\n# Set Katar Environment Variable\nexport $1=$2\" >> /home/vagrant/.profile"
|
139
|
+
s.args = [var["key"], var["value"]]
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
end
|
data/lib/katar.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
# VM Box Settings
|
3
|
+
ip: "192.168.10.12"
|
4
|
+
memory: 2048
|
5
|
+
cpus: 1
|
6
|
+
|
7
|
+
# Public Key For SSH Access
|
8
|
+
authorize: ~/.ssh/id_rsa.pub
|
9
|
+
|
10
|
+
# SSH Private Keys For The Box
|
11
|
+
keys:
|
12
|
+
- ~/.ssh/id_rsa
|
13
|
+
|
14
|
+
# Folders You Wish To Share With The Box
|
15
|
+
folders:
|
16
|
+
- map: ~/Workspace
|
17
|
+
to: /home/vagrant/Workspace
|
18
|
+
|
19
|
+
# GUI mode
|
20
|
+
# desktop: true
|
21
|
+
|
22
|
+
# Server Environment Variables For The Box
|
23
|
+
# variables:
|
24
|
+
# - key: APP_ENV
|
25
|
+
# value: local
|
26
|
+
|
27
|
+
# Forward Additional Ports To The Box
|
28
|
+
# ports:
|
29
|
+
# - send: 50000
|
30
|
+
# to: 5000
|
31
|
+
# - send: 7777
|
32
|
+
# to: 777
|
33
|
+
# protocol: udp
|
34
|
+
|
35
|
+
# Configure The Box Behind A Proxy
|
36
|
+
# proxies:
|
37
|
+
# - http: http://proxy.net:80
|
38
|
+
# https: http://proxy.net:80
|
39
|
+
|
data/lib/stubs/after.sh
ADDED
data/lib/stubs/aliases
ADDED
data/lib/stubs/sshconfig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Add ssh configuration to your Katar box below.
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: katar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- AcMitch
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.3'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.3.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.3'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.3.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rubyzip
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.1'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.1.7
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.1'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.1.7
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bundler
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '1.7'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '1.7'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rake
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '10.0'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '10.0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: thor
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.19.1
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 0.19.1
|
95
|
+
description: Katar provides a simple, elegant way to manage and provision a Vagrant
|
96
|
+
box on your local machine.
|
97
|
+
email:
|
98
|
+
- adam.cameron.mitchell@gmail.com
|
99
|
+
executables:
|
100
|
+
- katar
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- Vagrantfile
|
110
|
+
- bin/katar
|
111
|
+
- katar.gemspec
|
112
|
+
- lib/katar.rb
|
113
|
+
- lib/katar/cli.rb
|
114
|
+
- lib/katar/commands/application.rb
|
115
|
+
- lib/katar/commands/edit_command.rb
|
116
|
+
- lib/katar/commands/init_command.rb
|
117
|
+
- lib/katar/globals.rb
|
118
|
+
- lib/katar/vagrant.rb
|
119
|
+
- lib/katar/version.rb
|
120
|
+
- lib/scripts/clear-variables.sh
|
121
|
+
- lib/stubs/Katar.yaml
|
122
|
+
- lib/stubs/after.sh
|
123
|
+
- lib/stubs/aliases
|
124
|
+
- lib/stubs/sshconfig
|
125
|
+
homepage: ''
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.4.4
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Katar provides a simple, elegant way to manage and provision a Vagrant box
|
149
|
+
on your local machine.
|
150
|
+
test_files: []
|
151
|
+
has_rdoc:
|