provision-vagrant 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generator.rb +0 -1
- data/lib/provision_vagrant.rb +1 -1
- data/lib/pv_initializer.rb +10 -3
- data/lib/templates/Vagrantfile.template +108 -0
- data/lib/templates/provision-vagrant.post-hook.sh +55 -0
- data/lib/templates/provision-vagrant.yml +3 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9adc6fcbca2088bc8a637e0c215b21443b013389321e0fb5ecf0504b220f1c4c
|
4
|
+
data.tar.gz: b380e11dd246554885af2565ae7805f7200daac51f6ed514420468acf6666aa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 365c5fd2787d865e483485b138f164b56ec5bb8ecffa607350edc82ed94b28cdbe5d82341fc91543be83cc7d3eabd7bee5f7d06711ef3bc449a9cb37f0f4249b
|
7
|
+
data.tar.gz: b897fec0fe5fa23ed27f4b69d740668a10999fe752e92d1de6d305b7f117cc874d3ab47e3d6c5545feb9e1a41d975c179b826454bba80db7daf2a1f5be0750ab
|
data/lib/generator.rb
CHANGED
data/lib/provision_vagrant.rb
CHANGED
data/lib/pv_initializer.rb
CHANGED
@@ -64,8 +64,13 @@ module ProvisionVagrant
|
|
64
64
|
|
65
65
|
attr_accessor :opts
|
66
66
|
|
67
|
+
def gem_template_dir
|
68
|
+
@_gem_dir ||= File.join(File.dirname(__FILE__), "templates")
|
69
|
+
end
|
70
|
+
|
67
71
|
def source_vagrantfile_path
|
68
|
-
@_source_vagrantfile_path ||= File.join(
|
72
|
+
@_source_vagrantfile_path ||= File.join(gem_template_dir, VAGRANTFILE_NAME)
|
73
|
+
#@_source_vagrantfile_path ||= File.join(Dir.pwd, "..", VAGRANTFILE_NAME)
|
69
74
|
end
|
70
75
|
|
71
76
|
def target_vagrantfile_path
|
@@ -73,7 +78,8 @@ module ProvisionVagrant
|
|
73
78
|
end
|
74
79
|
|
75
80
|
def source_post_hook_path
|
76
|
-
|
81
|
+
#@_source_post_hook_path ||= File.join(Dir.pwd, "..", POST_HOOK_FILE_NAME)
|
82
|
+
@_source_post_hook_path ||= File.join(gem_template_dir, POST_HOOK_FILE_NAME)
|
77
83
|
end
|
78
84
|
|
79
85
|
def target_post_hook_path
|
@@ -81,7 +87,8 @@ module ProvisionVagrant
|
|
81
87
|
end
|
82
88
|
|
83
89
|
def source_provision_vagrant_config_path
|
84
|
-
|
90
|
+
#@_source_provision_vagrant_config_path ||= File.join(Dir.pwd, "..", PROVISION_VAGRANT_CONFIG_FILE_NAME)
|
91
|
+
@_source_provision_vagrant_config_path ||= File.join(gem_template_dir, PROVISION_VAGRANT_CONFIG_FILE_NAME)
|
85
92
|
end
|
86
93
|
|
87
94
|
def target_provision_vagrant_config_path
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
5
|
+
# configures the configuration version (we support older styles for
|
6
|
+
# backwards compatibility). Please don't change it unless you know what
|
7
|
+
# you're doing.
|
8
|
+
Vagrant.configure("2") do |config|
|
9
|
+
# The most common configuration options are documented and commented below.
|
10
|
+
# For a complete reference, please see the online documentation at
|
11
|
+
# https://docs.vagrantup.com.
|
12
|
+
|
13
|
+
# Every Vagrant development environment requires a box. You can search for
|
14
|
+
# boxes at https://vagrantcloud.com/search.
|
15
|
+
config.vm.box = "{{vm_box}}"
|
16
|
+
|
17
|
+
# Disable automatic box update checking. If you disable this, then
|
18
|
+
# boxes will only be checked for updates when the user runs
|
19
|
+
# `vagrant box outdated`. This is not recommended.
|
20
|
+
# config.vm.box_check_update = false
|
21
|
+
|
22
|
+
config.vm.provider "virtualbox" do |v|
|
23
|
+
v.name = "{{project_name}}-dev-box"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Create a forwarded port mapping which allows access to a specific port
|
27
|
+
# within the machine from a port on the host machine. In the example below,
|
28
|
+
# accessing "localhost:8080" will access port 80 on the guest machine.
|
29
|
+
# NOTE: This will enable public access to the opened port
|
30
|
+
|
31
|
+
config.vm.network :forwarded_port, guest: 3000, host: 3000
|
32
|
+
|
33
|
+
config.vm.provider "virtualbox" do |v|
|
34
|
+
v.memory = 4096
|
35
|
+
v.cpus = 2
|
36
|
+
end
|
37
|
+
|
38
|
+
# Create a forwarded port mapping which allows access to a specific port
|
39
|
+
# within the machine from a port on the host machine and only allow access
|
40
|
+
# via 127.0.0.1 to disable public access
|
41
|
+
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
|
42
|
+
|
43
|
+
# Create a private network, which allows host-only access to the machine
|
44
|
+
# using a specific IP.
|
45
|
+
# config.vm.network "private_network", ip: "192.168.33.10"
|
46
|
+
|
47
|
+
# Create a public network, which generally matched to bridged network.
|
48
|
+
# Bridged networks make the machine appear as another physical device on
|
49
|
+
# your network.
|
50
|
+
# config.vm.network "public_network"
|
51
|
+
|
52
|
+
# Share an additional folder to the guest VM. The first argument is
|
53
|
+
# the path on the host to the actual folder. The second argument is
|
54
|
+
# the path on the guest to mount the folder. And the optional third
|
55
|
+
# argument is a set of non-required options.
|
56
|
+
# config.vm.synced_folder "../data", "/vagrant_data"
|
57
|
+
|
58
|
+
# Provider-specific configuration so you can fine-tune various
|
59
|
+
# backing providers for Vagrant. These expose provider-specific options.
|
60
|
+
# Example for VirtualBox:
|
61
|
+
#
|
62
|
+
# config.vm.provider "virtualbox" do |vb|
|
63
|
+
# # Display the VirtualBox GUI when booting the machine
|
64
|
+
# vb.gui = true
|
65
|
+
#
|
66
|
+
# # Customize the amount of memory on the VM:
|
67
|
+
# vb.memory = "1024"
|
68
|
+
# end
|
69
|
+
#
|
70
|
+
# View the documentation for the provider you are using for more
|
71
|
+
# information on available options.
|
72
|
+
|
73
|
+
# Enable provisioning with a shell script. Additional provisioners such as
|
74
|
+
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
75
|
+
|
76
|
+
# documentation for more information about their specific syntax and use.
|
77
|
+
|
78
|
+
config.vm.provision "file", source: "~/.ssh/id_rsa", destination: "~/.ssh/id_rsa"
|
79
|
+
config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/id_rsa.pub"
|
80
|
+
config.vm.provision "file", source: "~/provision-vagrant.post-hook.sh", destination: "~/provision-vagrant.post-hook.sh"
|
81
|
+
config.vm.provision "shell", inline: <<-SHELL
|
82
|
+
|
83
|
+
echo "Updating & upgrading apt ..."
|
84
|
+
sudo apt update
|
85
|
+
sudo apt -y upgrade
|
86
|
+
|
87
|
+
echo "Installing some prereqs (git-core, curl) ..."
|
88
|
+
sudo apt install -y curl
|
89
|
+
|
90
|
+
echo "Installing nodejs & yarn ..."
|
91
|
+
curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
|
92
|
+
sudo -E bash nodesource_setup.sh
|
93
|
+
sudo apt-get install -y nodejs
|
94
|
+
npm install --global yarn
|
95
|
+
|
96
|
+
echo "Installing dependencies..."
|
97
|
+
sudo apt install -y git-core postgresql-common libpq-dev autoconf automake zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev libgdbm-dev libncurses5-dev bison
|
98
|
+
|
99
|
+
echo "Installing PostgreSQL ..."
|
100
|
+
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
|
101
|
+
sudo apt install -y postgresql
|
102
|
+
sudo systemctl restart postgresql
|
103
|
+
|
104
|
+
echo "Setting provision-vagrant post hook bash script to executable ..."
|
105
|
+
chmod +x /home/vagrant/provision-vagrant.post-hook.sh
|
106
|
+
|
107
|
+
SHELL
|
108
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/bash
|
2
|
+
|
3
|
+
echo "Executing ~/provision-vagrant.post-hook.sh ..."
|
4
|
+
|
5
|
+
echo "Setting .ssh/ file permissions ..."
|
6
|
+
chmod 700 /home/vagrant/.ssh/
|
7
|
+
chmod 600 /home/vagrant/.ssh/authorized_keys
|
8
|
+
chmod 600 /home/vagrant/.ssh/id_rsa
|
9
|
+
chmod 644 /home/vagrant/.ssh/id_rsa.pub
|
10
|
+
|
11
|
+
echo "Configuring git..."
|
12
|
+
git config --global color.ui true
|
13
|
+
git config --global user.name {{github_name}}
|
14
|
+
git config --global user.email {{github_email}}
|
15
|
+
|
16
|
+
echo "Installing rbenv ..."
|
17
|
+
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
|
18
|
+
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> /home/vagrant/.bashrc
|
19
|
+
echo 'eval "$(rbenv init -)"' >> /home/vagrant/.bashrc
|
20
|
+
export PATH="$HOME/.rbenv/bin:$PATH"
|
21
|
+
eval "$(rbenv init -)"
|
22
|
+
echo "gem: --no-document" > ~/.gemrc
|
23
|
+
|
24
|
+
echo "Installing a ruby ..."
|
25
|
+
/home/vagrant/.rbenv/bin/rbenv install {{ruby_version}}
|
26
|
+
/home/vagrant/.rbenv/bin/rbenv global {{ruby_version}}
|
27
|
+
|
28
|
+
echo "Installing bundler gem ..."
|
29
|
+
gem install bundler
|
30
|
+
|
31
|
+
echo "Adding ~/.bashrc customizations ..."
|
32
|
+
echo "alias rails-server='bundle exec rails s -b 0.0.0.0'" >> /home/vagrant/.bashrc
|
33
|
+
|
34
|
+
echo "Setting up PostgreSQL permissions to allow local access ..."
|
35
|
+
sudo su - postgres << EOF
|
36
|
+
sed -i 's/local all all peer/local all all trust/g' /etc/postgresql/16/main/pg_hba.conf
|
37
|
+
psql -c "CREATE USER vagrant WITH ENCRYPTED PASSWORD 'password';"
|
38
|
+
psql -c "ALTER USER vagrant CREATEDB;"
|
39
|
+
psql -c "ALTER ROLE vagrant PASSWORD null;"
|
40
|
+
EOF
|
41
|
+
|
42
|
+
echo "Showing versions ..."
|
43
|
+
sudo systemctl status postgresql
|
44
|
+
node -v
|
45
|
+
yarn --version
|
46
|
+
ruby -v
|
47
|
+
gem -v
|
48
|
+
bundle -v
|
49
|
+
|
50
|
+
echo ""
|
51
|
+
echo "Authenticating with GitHub via ssh ..."
|
52
|
+
echo ""
|
53
|
+
echo "Now checking to see if we now have github SSH access via command: ssh -T git@github.com"
|
54
|
+
echo ""
|
55
|
+
ssh -T git@github.com
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: provision-vagrant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shanti Braford
|
@@ -73,6 +73,9 @@ files:
|
|
73
73
|
- lib/options.rb
|
74
74
|
- lib/provision_vagrant.rb
|
75
75
|
- lib/pv_initializer.rb
|
76
|
+
- lib/templates/Vagrantfile.template
|
77
|
+
- lib/templates/provision-vagrant.post-hook.sh
|
78
|
+
- lib/templates/provision-vagrant.yml
|
76
79
|
homepage: https://github.com/sbraford/provision-vagrant
|
77
80
|
licenses:
|
78
81
|
- MIT
|