-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
52 lines (48 loc) · 2.21 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# frozen_string_literal: true
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = 'genebean/centos-7-puppet-latest'
config.vm.hostname = 'dockerhost.localdomain'
config.vm.network 'forwarded_port', guest: 80, host: 8080
config.vm.provision 'shell',
name: 'Pull insecure vagrant_priv_key',
inline: <<-EOF
set -e
curl -o /home/vagrant/.ssh/vagrant_priv_key https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant
chown vagrant.vagrant /home/vagrant/.ssh/vagrant_priv_key
chmod 600 /home/vagrant/.ssh/vagrant_priv_key
EOF
config.vm.provision 'shell',
name: 'Install Puppet Modules',
inline: 'puppet module install puppetlabs-docker --version 3.5.0'
config.vm.provision 'shell',
name: 'Install Docker',
inline: "puppet apply -e \"class { 'docker': log_driver => 'journald' }\""
config.vm.provision 'shell',
name: 'Update Gemfile.lock',
inline: '/vagrant/update-gemfile-dot-lock.sh'
config.vm.provision 'shell',
name: 'System setup',
inline: 'puppet apply /vagrant/docker.pp'
config.vm.provision 'shell',
name: 'List running containers',
inline: 'docker ps'
config.vm.provision 'shell',
name: 'Test container',
inline: "docker exec johnny_appleseed /bin/sh -c 'bundle exec rake test'"
config.vm.provision 'shell',
name: 'API test',
inline: <<-EOF
set -e
rm -rf /home/vagrant/trees/tree-planter*
curl -H "Content-Type: application/json" -X POST -d \
'{"ref":"refs/heads/main", "repository":{"name":"tree-planter", "url":"https://github.com/genebean/tree-planter.git" }}' \
http://localhost:80/deploy
curl -H "Content-Type: application/json" -X POST -d \
'{"ref":"refs/heads/main", "repository":{"name":"tree-planter", "url":"https://github.com/genebean/tree-planter.git" }}' \
http://localhost:80/gitlab
ls -ld /home/vagrant/trees/
ls -l /home/vagrant/trees/
EOF
end