Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flame-clmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flame
flame-clmc
Commits
dfbb41df
Commit
dfbb41df
authored
7 years ago
by
Rowan Powell
Browse files
Options
Downloads
Patches
Plain Diff
Reformatted vagrantfile, added /infra/streaming/rspec.yml
parent
e562398d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Vagrantfile
+63
-153
63 additions, 153 deletions
Vagrantfile
with
63 additions
and
153 deletions
Vagrantfile
+
63
−
153
View file @
dfbb41df
...
@@ -22,168 +22,78 @@
...
@@ -22,168 +22,78 @@
#// Created for Project : FLAME
#// Created for Project : FLAME
#//
#//
#/////////////////////////////////////////////////////////////////////////
#/////////////////////////////////////////////////////////////////////////
# Define ipendpoint configuration parameters
# Requirements
require
'getoptlong'
require
'yaml'
ipendpoints
=
{
"apache1"
=>
{
:ip_address
=>
"192.168.50.11"
,
:location
=>
"DC1"
,
:sfc_id
=>
"MS_Template_1"
,
:sfc_id_instance
=>
"MS_I1"
,
:sf_id
=>
"adaptive_streaming"
,
:sf_id_instance
=>
"adaptive_streaming_I1"
,
:ipendpoint_id
=>
"adaptive_streaming_I1_apache1"
,
:influxdb_url
=>
"http://192.168.50.10:8086"
,
:database_name
=>
"CLMCMetrics"
},
"apache2"
=>
{
:ip_address
=>
"192.168.50.12"
,
:location
=>
"DC2"
,
:sfc_id
=>
"MS_Template_1"
,
:sfc_id_instance
=>
"MS_I1"
,
:sf_id
=>
"adaptive_streaming"
,
:sf_id_instance
=>
"adaptive_streaming_I1"
,
:ipendpoint_id
=>
"adaptive_streaming_I1_apache2"
,
:influxdb_url
=>
"http://192.168.50.10:8086"
,
:database_name
=>
"CLMCMetrics"
},
"nginx1"
=>
{
:ip_address
=>
"192.168.50.13"
,
:location
=>
"DC1"
,
:sfc_id
=>
"MS_Template_1"
,
:sfc_id_instance
=>
"MS_I1"
,
:sf_id
=>
"adaptive_streaming"
,
:sf_id_instance
=>
"adaptive_streaming_nginx_I1"
,
:ipendpoint_id
=>
"adaptive_streaming_nginx_I1_apache1"
,
:influxdb_url
=>
"http://192.168.50.10:8086"
,
:database_name
=>
"CLMCMetrics"
},
"mongo1"
=>
{
:ip_address
=>
"192.168.50.14"
,
:location
=>
"DC1"
,
:sfc_id
=>
"MS_Template_1"
,
:sfc_id_instance
=>
"MS_I1"
,
:sf_id
=>
"metadata_database"
,
:sf_id_instance
=>
"metadata_database_I1"
,
:ipendpoint_id
=>
"metadata_database_I1_apache1"
,
:influxdb_url
=>
"http://192.168.50.10:8086"
,
:database_name
=>
"CLMCMetrics"
}
}
# Custom options:
# --infra <infradir>
Vagrant
.
configure
(
"2"
)
do
|
config
|
# Set defaults
config
.
vm
.
box
=
"ubuntu/xenial64"
DEFAULT_INFRA
=
"streaming"
config
.
vm
.
define
"clmc-service"
do
|
my
|
config
.
vm
.
network
:private_network
,
ip:
"192.168.50.10"
,
virtualbox__intnet:
"clmc-net"
my
.
vm
.
provider
"virtualbox"
do
|
v
|
v
.
customize
[
"modifyvm"
,
:id
,
"--memory"
,
2048
]
v
.
customize
[
"modifyvm"
,
:id
,
"--cpus"
,
1
]
end
# open InfluxDB port
config
.
vm
.
network
"forwarded_port"
,
guest:
8086
,
host:
8086
# open Chronograf port
config
.
vm
.
network
"forwarded_port"
,
guest:
8888
,
host:
8888
# open Kapacitor port
config
.
vm
.
network
"forwarded_port"
,
guest:
9092
,
host:
9092
# install the CLMC service
config
.
vm
.
provision
:shell
,
:path
=>
'scripts/clmc-service/install-clmc-service.sh'
# start the CLMC service
config
.
vm
.
provision
:shell
,
:path
=>
'scripts/clmc-service/start-clmc-service.sh'
end
# Apache Server 1
config
.
vm
.
define
"apache1"
do
|
my
|
config
.
vm
.
network
:private_network
,
ip:
"
#{
ipendpoints
[
'apache1'
][
:ip_address
]
}
"
,
virtualbox__intnet:
"clmc-net"
my
.
vm
.
provider
"virtualbox"
do
|
v
|
v
.
customize
[
"modifyvm"
,
:id
,
"--memory"
,
512
]
v
.
customize
[
"modifyvm"
,
:id
,
"--cpus"
,
1
]
end
# open apache port
config
.
vm
.
network
"forwarded_port"
,
guest:
80
,
host:
8081
# install the apache service
config
.
vm
.
provision
:shell
,
:path
=>
'test/services/apache/install-apache.sh'
# Install CLMC agent 1
config
.
vm
.
provision
:shell
,
:path
=>
'scripts/clmc-agent/install-clmc-agent.sh'
,
:args
=>
"/vagrant/test/services/apache/telegraf_apache_template.conf
#{
ipendpoints
[
'apache1'
][
:location
]
}
#{
ipendpoints
[
'apache1'
][
:sfc_id
]
}
#{
ipendpoints
[
'apache1'
][
:sfc_id_instance
]
}
#{
ipendpoints
[
'apache1'
][
:sf_id
]
}
#{
ipendpoints
[
'apache1'
][
:sf_id_instance
]
}
#{
ipendpoints
[
'apache1'
][
:ipendpoint_id
]
}
#{
ipendpoints
[
'apache1'
][
:influxdb_url
]
}
#{
ipendpoints
[
'apache1'
][
:database_name
]
}
"
end
# Apache Server 2
config
.
vm
.
define
"apache2"
do
|
my
|
config
.
vm
.
network
:private_network
,
ip:
"
#{
ipendpoints
[
'apache2'
][
:ip_address
]
}
"
,
virtualbox__intnet:
"clmc-net"
my
.
vm
.
provider
"virtualbox"
do
|
v
|
v
.
customize
[
"modifyvm"
,
:id
,
"--memory"
,
512
]
v
.
customize
[
"modifyvm"
,
:id
,
"--cpus"
,
1
]
end
# open apache port
# Define custom options
config
.
vm
.
network
"forwarded_port"
,
guest:
80
,
host:
8082
opts
=
GetoptLong
.
new
(
[
'--infra'
,
GetoptLong
::
OPTIONAL_ARGUMENT
]
)
# install the apache service
# Retrieve custom option values
config
.
vm
.
provision
:shell
,
:path
=>
'test/services/apache/install-apache.sh'
infra
=
DEFAULT_INFRA
opts
.
each
do
|
opt
,
arg
|
case
opt
when
'--infra'
infra
=
arg
end
end
# Install CLMC agent
# load custom config file
config
.
vm
.
provision
:shell
,
:path
=>
'scripts/clmc-agent/install-clmc-agent.sh'
,
:args
=>
"/vagrant/test/services/apache/telegraf_apache_template.conf
#{
ipendpoints
[
'apache2'
][
:location
]
}
#{
ipendpoints
[
'apache2'
][
:sfc_id
]
}
#{
ipendpoints
[
'apache2'
][
:sfc_id_instance
]
}
#{
ipendpoints
[
'apache2'
][
:sf_id
]
}
#{
ipendpoints
[
'apache2'
][
:sf_id_instance
]
}
#{
ipendpoints
[
'apache2'
][
:ipendpoint_id
]
}
#{
ipendpoints
[
'apache2'
][
:influxdb_url
]
}
#{
ipendpoints
[
'apache2'
][
:database_name
]
}
"
puts
"loading custom infrastructure configuration:
#{
infra
}
"
end
puts
"custom config file: /infra/
#{
infra
}
/rspec.yml"
host_rspec_file
=
"infra/
#{
infra
}
/rspec.yml"
# NGINX VM
hosts
=
YAML
.
load_file
(
host_rspec_file
)
config
.
vm
.
define
"NGINX_Service"
do
|
my
|
config
.
vm
.
network
:private_network
,
ip:
"
#{
ipendpoints
[
'nginx1'
][
:ip_address
]
}
"
,
virtualbox__intnet:
"clmc-net"
my
.
vm
.
provider
"virtualbox"
do
|
v
|
# Start creating VMS using xenial64 as the base box
v
.
customize
[
"modifyvm"
,
:id
,
"--memory"
,
512
]
Vagrant
.
configure
(
"2"
)
do
|
config
|
v
.
customize
[
"modifyvm"
,
:id
,
"--cpus"
,
1
]
config
.
vm
.
box
=
"ubuntu/xenial64"
# Dynamic VMs
hosts
[
'hosts'
].
each
do
|
host
|
#p host["name"]
instance_name
=
host
[
"name"
]
config
.
vm
.
define
instance_name
do
|
instance_config
|
# Specify VM properties
instance_config
.
vm
.
hostname
=
instance_name
instance_config
.
disksize
.
size
=
host
[
"disk"
]
instance_config
.
vm
.
provider
"virtualbox"
do
|
v
|
v
.
customize
[
"modifyvm"
,
:id
,
"--memory"
,
host
[
"memory"
]]
v
.
customize
[
"modifyvm"
,
:id
,
"--cpus"
,
host
[
"cpus"
]]
end
end
# Configure network
# open apache port
config
.
vm
.
network
:private_network
,
ip:
"
#{
host
[
"ip_address"
]
}
"
,
virtualbox__intnet:
"clmc-net"
config
.
vm
.
network
"forwarded_port"
,
guest:
80
,
host:
8083
# Port forwarding
puts
"Forwarding the following specified ports for
#{
host
[
"name"
]
}
:"
# install the apache service
host
[
'forward_ports'
].
each
do
|
port
|
config
.
vm
.
provision
:shell
,
:path
=>
'test/services/nginx/install-nginx.sh'
puts
"Forwarding guest:
#{
port
[
"guest"
]
}
=> host:
#{
port
[
"host"
]
}
"
config
.
vm
.
network
"forwarded_port"
,
guest:
port
[
"guest"
],
host:
port
[
"host"
]
# Install CLMC agent
end
config
.
vm
.
provision
:shell
,
:path
=>
'scripts/clmc-agent/install-clmc-agent.sh'
,
:args
=>
"/vagrant/test/services/nginx/telegraf_nginx_template.conf
#{
ipendpoints
[
'nginx1'
][
:location
]
}
#{
ipendpoints
[
'nginx1'
][
:sfc_id
]
}
#{
ipendpoints
[
'nginx1'
][
:sfc_id_instance
]
}
#{
ipendpoints
[
'nginx1'
][
:sf_id
]
}
#{
ipendpoints
[
'nginx1'
][
:sf_id_instance
]
}
#{
ipendpoints
[
'nginx1'
][
:ipendpoint_id
]
}
#{
ipendpoints
[
'nginx1'
][
:influxdb_url
]
}
#{
ipendpoints
[
'nginx1'
][
:database_name
]
}
"
# Switch case added here to make clmc-service provisioning simple without having to have a complex rspec.yml file
end
# We only run a service installation script and the agent installation script when creating a specific service VM, not the clmc-service VM
case
host
# MONGODB VM
when
'clmc-service'
config
.
vm
.
define
"MONGO_Service"
do
|
my
|
config
.
vm
.
provision
:shell
,
:path
=>
"scripts/clmc-service/
#{
host
[
"install_script"
]
}
"
config
.
vm
.
provision
:shell
,
:path
=>
"scripts/clmc-service/
#{
host
[
"start_script"
]
}
"
config
.
vm
.
network
:private_network
,
ip:
"
#{
ipendpoints
[
'mongo1'
][
:ip_address
]
}
"
,
virtualbox__intnet:
"clmc-net"
when
(
not
'clmc-service'
)
# specific service install
my
.
vm
.
provider
"virtualbox"
do
|
v
|
service_install_path
=
"test/services/
#{
host
[
"service_name"
]
}
/install-
#{
host
[
"service_name"
]
}
.sh"
v
.
customize
[
"modifyvm"
,
:id
,
"--memory"
,
512
]
puts
"installing service script:
#{
service_install_path
}
"
v
.
customize
[
"modifyvm"
,
:id
,
"--cpus"
,
1
]
config
.
vm
.
provision
:shell
,
:path
=>
service_install_path
# agent install
config
.
vm
.
provision
:shell
,
:path
=>
"scripts/clmc-agent/install-clmc-agent.sh"
,
:args
=>
"/vagrant/test/services/
#{
host
[
"service_name"
]
}
/telegraf_
#{
host
[
"service_name"
]
}
_template.conf
#{
host
[
"location"
]
}
#{
host
[
"sfc_id"
]
}
#{
host
[
"sfc_id_instance"
]
}
#{
host
[
"sf_id"
]
}
#{
host
[
"sf_id_instance"
]
}
#{
host
[
"ipendpoint_id"
]
}
#{
host
[
"influxdb_url"
]
}
#{
host
[
"database_name"
]
}
"
end
end
end
# open apache port
config
.
vm
.
network
"forwarded_port"
,
guest:
80
,
host:
8084
# install the apache service
config
.
vm
.
provision
:shell
,
:path
=>
'test/services/mongo/install-mongo.sh'
# Install CLMC agent
config
.
vm
.
provision
:shell
,
:path
=>
'scripts/clmc-agent/install-clmc-agent.sh'
,
:args
=>
"/vagrant/test/services/mongo/telegraf_mongo_template.conf
#{
ipendpoints
[
'mongo1'
][
:location
]
}
#{
ipendpoints
[
'mongo1'
][
:sfc_id
]
}
#{
ipendpoints
[
'mongo1'
][
:sfc_id_instance
]
}
#{
ipendpoints
[
'mongo1'
][
:sf_id
]
}
#{
ipendpoints
[
'mongo1'
][
:sf_id_instance
]
}
#{
ipendpoints
[
'mongo1'
][
:ipendpoint_id
]
}
#{
ipendpoints
[
'mongo1'
][
:influxdb_url
]
}
#{
ipendpoints
[
'mongo1'
][
:database_name
]
}
"
end
config
.
vm
.
define
"telegraf"
do
|
my
|
end
end
config
.
vm
.
define
"ipendpoint1"
do
|
my
|
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment