Skip to content

Instantly share code, notes, and snippets.

@hyunto
Last active December 6, 2017 05:01
Show Gist options
  • Save hyunto/65027814cc210ccf47e35c5d5d4f01c0 to your computer and use it in GitHub Desktop.
Save hyunto/65027814cc210ccf47e35c5d5d4f01c0 to your computer and use it in GitHub Desktop.
Vagrant로 Spinnaker를 설치합니다.
#-*- mode: ruby -*
# vi: set ft=ruby :
# Global Variables
$hostname = 'spinnaker-01'
# Minimum Vagrant Version
Vagrant.require_version '>= 2.0.0'
# Overwrite host locale in ssh session
ENV['LC_ALL'] = 'en_US.UTF-8'
# Provisioning shell scripts
$basic = <<SCRIPT
printf '=%.0s' {1..82}
echo 'Adding open-jdk PPA in apt-repository...'
sudo add-apt-repository ppa:openjdk-r/ppa > /dev/null 2>&1
sleep 1
echo 'Updating packages...'
sudo apt-get update > /dev/null 2>&1
sleep 1
echo 'Installing essential programs...'
echo -e '\t* Installing curl'
sudo apt-get install -y curl > /dev/null 2>&1
echo -e '\t* Installing vim'
sudo apt-get install -y vim > /dev/null 2>&1
echo -e '\t* Installing aptitude'
sudo apt-get install -y aptitude > /dev/null 2>&1
echo -e '\t* Installing build-essential'
sudo apt-get install -y build-essential > /dev/null 2>&1
echo -e '\t* Installing apt-transport-https'
sudo apt-get install -y apt-transport-https > /dev/null 2>&1
echo -e '\t* Installing software-properties-common'
sudo apt-get install -y software-properties-common > /dev/null 2>&1
echo -e '\t* Installing python-software-properties'
sudo apt-get install -y python-software-properties > /dev/null 2>&1
sleep 3
SCRIPT
$halyard = <<SCRIPT
printf '=%.0s' {1..82}
echo -e 'Installing halyard of spinnaker for configuration...'
sleep 3
echo -e '\t* Create user named \'spinnaker\''
sudo useradd spinnaker
sleep 1
echo -e '\t* Downloading InstallHalyard.sh'
curl -O https://raw.githubusercontent.com/spinnaker/halyard/master/install/stable/InstallHalyard.sh
sleep 1
echo -e '\t* Executing InstallHalyard.sh'
sudo bash InstallHalyard.sh --user spinnaker
sleep 1
echo -e '\t* Checking halyard installed property'
hal -v
sleep 3
SCRIPT
$spinnaker = <<SCRIPT
printf '=%.0s' {1..82}
echo -e 'Configuring spinnaker environment...'
sleep 1
echo -e "\t* hal config deploy edit --type localdebian"
hal config deploy edit --type localdebian
sleep 1
echo -e "\t* hal config storage edit --type redis"
hal config storage edit --type redis
sleep 1
echo -e "\t* hal config ci jenkins enable"
hal config ci jenkins enable
echo "f3dc8d2f35a20d027a6a27b28920cdf4" | hal config ci jenkins master add cp-vm-ci --address http://cp-vm-ci.korea.ncsoft.corp:8080 --username tcbuilder --password
sleep 1
echo -e "\t* hal config version edit --version 1.4.2"
hal config version edit --version 1.4.2
sleep 1
echo -e "\t* Exposing the spinnaker to end users"
echo "host: 0.0.0.0" | tee /home/spinnaker/.hal/default/service-settings/deck.yml
echo "host: 0.0.0.0" | tee /home/spinnaker/.hal/default/service-settings/gate.yml
sleep 1
echo -e "\t* hal deploy apply"
hal deploy apply
sleep 3
SCRIPT
# Vagrant settings
Vagrant.configure('2') do |config|
#=============================================================================
# Machine Settings
# - Config namespace : config.vm
# - Description : The settings within config.vm modify the configuration of
# the machine that Vagrant manages
# - Document : https://www.vagrantup.com/docs/vagrantfile/machine_settings.html
#
# Excluded Options (Use default) :
# - config.vm.box.download_client_cert
# - config.vm.box_download_ca_cert
# - config.vm.box_download_ca_path
# - config.vm.box_download_insecure
# - config.vm.box_download_location_trusted
# - config.vm.box_url
# - config.vm.box_version
#=============================================================================
# The time in seconds that Vagrant will wait for the machine to boot
# and be accessible.
# By default this is 300 seconds.
config.vm.boot_timeout = 300
# This configures what box the machine will be brought up against.
# The value here should be the name of an installed box or a shorthand name
# of a box in HashiCorp's Vagrant Cloud.
# - Vagrant Cloud : https://app.vagrantup.com
config.vm.box = 'ubuntu/trusty64'
# If true, Vagrant will check for updates to the configured box on every vagrant up.
# If an update is found, Vagrant will tell the user.
# By default this is true.
# Updates will only be checked for boxes that properly support updates
# (boxes from HashiCorp's Vagrant Cloud or some other versioned box).
config.vm.box_check_update = true
# The checksum of the box specified by config.vm.box_url.
# If not specified, no checksum comparison will be done.
# If specified, Vagrant will compare the checksum of the downloaded box
# to this value and error if they do not match.
# Checksum checking is only done when Vagrant must download the box.
#
# If this is specified, then config.vm.box_download_checksum_type must also be specified.
config.vm.box_download_checksum = true
# The type of checksum specified by config.vm.box_download_checksum (if any).
# Supported values are currently "md5", "sha1", and "sha256".
config.vm.box_download_checksum_type = 'sha256'
# The communicator type to use to connect to the guest box.
# By default this is "ssh", but should be changed to "winrm" for Windows guests.
config.vm.communicator = 'ssh'
# The time in seconds that Vagrant will wait for the machine to gracefully
# halt when vagrant halt is called. Defaults to 60 seconds.
config.vm.graceful_halt_timeout = 60
# The guest OS that will be running within this machine.
# This defaults to :linux, and Vagrant will auto-detect the proper distro.
# Vagrant needs to know this information to perform some guest OS-specific things
# such as mounting folders and configuring networks.
##config.vm.guest = 'linux'
# The hostname the machine should have. Defaults to nil.
# If nil, Vagrant will not manage the hostname.
# If set to a string, the hostname will be set on boot.
# #config.vm.hostname = "default"
# A message to show after vagrant up.
# This will be shown to the user and is useful for containing instructions
# such as how to access various components of the development environment.
config.vm.post_up_message = "
Vagrant virtual machine has been started successfully! :)
This is useful command to use a vagrant. It will help you.
If you want to access the VM, use this command :
$ vagrant ssh
If you want to start the VM, use this command :
$ vagrant up
If you want to suspend th VM, use this command :
$ vagrant suspend
If you want to stop the VM, use this command :
$ vagrant halt
If you want to delete the VM, use this command :
$ vagrant destroy
If you want to check the status of VM, use this command :
$ vagrant status
If you re-configure the provision settings and want to reload, use this command :
$ vagrant provision
Good Luck!
"
# Configures network on the machine.
# - Document : https://www.vagrantup.com/docs/networking/
##config.vm.network "public_network", use_dhcp_assigned_default_route: true
config.vm.network "forwarded_port", host_ip: "127.0.0.1", host: 2201, guest_ip: "127.0.0.1", guest: 9000
config.vm.network "private_network", ip: "192.168.104.19"
# Configures provider-specific configuration, which is used to modify settings
# which are specific to a certain provider.
# If the provider you are configuring does not exist or is not setup on the system
# of the person who runs vagrant up, Vagrant will ignore this configuration block.
#
# This allows a Vagrantfile that is configured for many providers to be shared
# among a group of people who may not have all the same providers installed.
#
# Settings written below is just for Virtualbox.
# - Document : https://www.vagrantup.com/docs/providers/
config.vm.provider 'virtualbox' do |vb|
vb.gui = false
vb.name = $hostname
vb.cpus = 1
vb.memory = 4096
end
# Configures provisioners on the machine, so that software can be automatically
# installed and configured when the machine is created.
# Please see the page on provisioners for more information on how this setting works.
# - Document : https://www.vagrantup.com/docs/provisioning/
# #config.vm.provision "shell", privileged: false, path: "init-vagrant.sh"
config.vm.provision 'basic', type: 'shell', inline: $basic
config.vm.provision 'halyard', type: 'shell', inline: $halyard
config.vm.provision 'spinnaker', type: 'shell', inline: $spinnaker
# Configures synced folders on the machine,
# so that folders on your host machine can be synced to and from the guest machine.
# Please see the page on synced folders for more information on how this setting works.
# - Document : https://www.vagrantup.com/docs/synced-folders/
# #config.vm.synced_folder = ""
# A range of ports Vagrant can use for handling port collisions and such.
# Defaults to 2200..2250.
# #config.vm.usable_port_range = ""
end
#-*- mode: ruby -*
# vi: set ft=ruby :
# Global Variables
$hostname = 'spinnaker-with-minio'
# Minimum Vagrant Version
Vagrant.require_version '>= 2.0.0'
# Overwrite host locale in ssh session
ENV['LC_ALL'] = 'en_US.UTF-8'
# Provisioning shell scripts
$basic = <<SCRIPT
sudo add-apt-repository ppa:openjdk-r/ppa > /dev/null 2>&1
sudo apt-get update
sudo apt-get install -y curl vim aptitude build-essential apt-transport-https software-properties-common python-software-properties
SCRIPT
$halyard = <<SCRIPT
sudo useradd spinnaker
curl -O https://raw.githubusercontent.com/spinnaker/halyard/master/install/stable/InstallHalyard.sh
sudo bash InstallHalyard.sh --user spinnaker
hal -v
SCRIPT
$minio = <<SCRIPT
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=miniostorage
export MINIO_BROWSER=on
export MINIO_REGION=us-east-1
wget https://dl.minio.io/server/minio/release/linux-amd64/minio
chmod +x minio
mv minio /usr/local/bin/minio
mkdir /data/minio
minio server --address 0.0.0.0:62222 /data/minio &
SCRIPT
$spinnaker = <<SCRIPT
hal config version edit --version 1.4.2
hal config deploy edit --type localdebian
echo "miniostorage" | hal config storage s3 edit --access-key-id minio --secret-access-key --region us-east-1 --endpoint http://localhost:62222
hal config storage edit --type s3
hal config ci jenkins enable
echo "f3dc8d2f35a20d027a6a27b28920cdf4" | hal config ci jenkins master add cp-vm-ci --address http://cp-vm-ci.korea.ncsoft.corp:8080 --username tcbuilder --password
hal config provider azure enable
echo "5824667c-d1c2-4911-9b4f-1b0e626052e8" | hal config provider azure account add hyunsoo-azure-account --client-id eed47668-b131-4326-bde0-f0ea6a2da0dc --tenant-id 964d740d-1ebe-4624-9a0c-990192a7b823 --subscription-id a405a334-42d9-4e3a-96e0-f473275eca90 --default-key-vault hyunsoo0813 --default-resource-group Spinnaker --app-key
echo "host: 0.0.0.0" | tee /home/spinnaker/.hal/default/service-settings/deck.yml
echo "host: 0.0.0.0" | tee /home/spinnaker/.hal/default/service-settings/gate.yml
hal config security ui edit --override-base-url http://192.168.104.21:9000
hal config security api edit --override-base-url http://192.168.104.21:8084
hal deploy apply
SCRIPT
# Vagrant settings
Vagrant.configure('2') do |config|
#=============================================================================
# Machine Settings
# - Config namespace : config.vm
# - Description : The settings within config.vm modify the configuration of
# the machine that Vagrant manages
# - Document : https://www.vagrantup.com/docs/vagrantfile/machine_settings.html
#
# Excluded Options (Use default) :
# - config.vm.box.download_client_cert
# - config.vm.box_download_ca_cert
# - config.vm.box_download_ca_path
# - config.vm.box_download_insecure
# - config.vm.box_download_location_trusted
# - config.vm.box_url
# - config.vm.box_version
#=============================================================================
# The time in seconds that Vagrant will wait for the machine to boot
# and be accessible.
# By default this is 300 seconds.
config.vm.boot_timeout = 300
# This configures what box the machine will be brought up against.
# The value here should be the name of an installed box or a shorthand name
# of a box in HashiCorp's Vagrant Cloud.
# - Vagrant Cloud : https://app.vagrantup.com
config.vm.box = 'ubuntu/trusty64'
# If true, Vagrant will check for updates to the configured box on every vagrant up.
# If an update is found, Vagrant will tell the user.
# By default this is true.
# Updates will only be checked for boxes that properly support updates
# (boxes from HashiCorp's Vagrant Cloud or some other versioned box).
config.vm.box_check_update = true
# The checksum of the box specified by config.vm.box_url.
# If not specified, no checksum comparison will be done.
# If specified, Vagrant will compare the checksum of the downloaded box
# to this value and error if they do not match.
# Checksum checking is only done when Vagrant must download the box.
#
# If this is specified, then config.vm.box_download_checksum_type must also be specified.
config.vm.box_download_checksum = true
# The type of checksum specified by config.vm.box_download_checksum (if any).
# Supported values are currently "md5", "sha1", and "sha256".
config.vm.box_download_checksum_type = 'sha256'
# The communicator type to use to connect to the guest box.
# By default this is "ssh", but should be changed to "winrm" for Windows guests.
config.vm.communicator = 'ssh'
# The time in seconds that Vagrant will wait for the machine to gracefully
# halt when vagrant halt is called. Defaults to 60 seconds.
config.vm.graceful_halt_timeout = 60
# The guest OS that will be running within this machine.
# This defaults to :linux, and Vagrant will auto-detect the proper distro.
# Vagrant needs to know this information to perform some guest OS-specific things
# such as mounting folders and configuring networks.
##config.vm.guest = 'linux'
# The hostname the machine should have. Defaults to nil.
# If nil, Vagrant will not manage the hostname.
# If set to a string, the hostname will be set on boot.
# #config.vm.hostname = "default"
# A message to show after vagrant up.
# This will be shown to the user and is useful for containing instructions
# such as how to access various components of the development environment.
config.vm.post_up_message = "
Vagrant virtual machine has been started successfully! :)
This is useful command to use a vagrant. It will help you.
If you want to access the VM, use this command :
$ vagrant ssh
If you want to start the VM, use this command :
$ vagrant up
If you want to suspend th VM, use this command :
$ vagrant suspend
If you want to stop the VM, use this command :
$ vagrant halt
If you want to delete the VM, use this command :
$ vagrant destroy
If you want to check the status of VM, use this command :
$ vagrant status
If you re-configure the provision settings and want to reload, use this command :
$ vagrant provision
Good Luck!
"
# Configures network on the machine.
# - Document : https://www.vagrantup.com/docs/networking/
##config.vm.network "public_network", use_dhcp_assigned_default_route: true
config.vm.network "forwarded_port", host_ip: "127.0.0.1", host: 2201, guest_ip: "127.0.0.1", guest: 9000
config.vm.network "private_network", ip: "192.168.104.21"
# Configures provider-specific configuration, which is used to modify settings
# which are specific to a certain provider.
# If the provider you are configuring does not exist or is not setup on the system
# of the person who runs vagrant up, Vagrant will ignore this configuration block.
#
# This allows a Vagrantfile that is configured for many providers to be shared
# among a group of people who may not have all the same providers installed.
#
# Settings written below is just for Virtualbox.
# - Document : https://www.vagrantup.com/docs/providers/
config.vm.provider 'virtualbox' do |vb|
vb.gui = false
vb.name = $hostname
vb.cpus = 1
vb.memory = 10240
end
# Configures provisioners on the machine, so that software can be automatically
# installed and configured when the machine is created.
# Please see the page on provisioners for more information on how this setting works.
# - Document : https://www.vagrantup.com/docs/provisioning/
# #config.vm.provision "shell", privileged: false, path: "init-vagrant.sh"
config.vm.provision 'basic', type: 'shell', inline: $basic
config.vm.provision 'halyard', type: 'shell', inline: $halyard
config.vm.provision 'minio', type: 'shell', inline: $minio
config.vm.provision 'spinnaker', type: 'shell', inline: $spinnaker
# Configures synced folders on the machine,
# so that folders on your host machine can be synced to and from the guest machine.
# Please see the page on synced folders for more information on how this setting works.
# - Document : https://www.vagrantup.com/docs/synced-folders/
# #config.vm.synced_folder = ""
# A range of ports Vagrant can use for handling port collisions and such.
# Defaults to 2200..2250.
# #config.vm.usable_port_range = ""
end
#-*- mode: ruby -*
# vi: set ft=ruby :
# Global Variables
$hostname = 'ubuntu-trusty-64'
# Minimum Vagrant Version
Vagrant.require_version '>= 2.0.0'
# Overwrite host locale in ssh session
ENV['LC_ALL'] = 'en_US.UTF-8'
$basic = <<SCRIPT
echo "Executing script named basic..."
SCRIPT
# Vagrant settings
Vagrant.configure('2') do |config|
#=============================================================================
# Machine Settings
# - Config namespace : config.vm
# - Description : The settings within config.vm modify the configuration of
# the machine that Vagrant manages
# - Document : https://www.vagrantup.com/docs/vagrantfile/machine_settings.html
#
# Excluded Options (Use default) :
# - config.vm.box.download_client_cert
# - config.vm.box_download_ca_cert
# - config.vm.box_download_ca_path
# - config.vm.box_download_insecure
# - config.vm.box_download_location_trusted
# - config.vm.box_url
# - config.vm.box_version
#=============================================================================
# The time in seconds that Vagrant will wait for the machine to boot
# and be accessible.
# By default this is 300 seconds.
config.vm.boot_timeout = 300
# This configures what box the machine will be brought up against.
# The value here should be the name of an installed box or a shorthand name
# of a box in HashiCorp's Vagrant Cloud.
# - Vagrant Cloud : https://app.vagrantup.com
config.vm.box = "ubuntu/trusty64"
config.vm.box_version = "0.0.1"
# If true, Vagrant will check for updates to the configured box on every vagrant up.
# If an update is found, Vagrant will tell the user.
# By default this is true.
# Updates will only be checked for boxes that properly support updates
# (boxes from HashiCorp's Vagrant Cloud or some other versioned box).
config.vm.box_check_update = true
# The checksum of the box specified by config.vm.box_url.
# If not specified, no checksum comparison will be done.
# If specified, Vagrant will compare the checksum of the downloaded box
# to this value and error if they do not match.
# Checksum checking is only done when Vagrant must download the box.
#
# If this is specified, then config.vm.box_download_checksum_type must also be specified.
config.vm.box_download_checksum = true
# The type of checksum specified by config.vm.box_download_checksum (if any).
# Supported values are currently "md5", "sha1", and "sha256".
config.vm.box_download_checksum_type = 'sha256'
# The communicator type to use to connect to the guest box.
# By default this is "ssh", but should be changed to "winrm" for Windows guests.
config.vm.communicator = 'ssh'
# The time in seconds that Vagrant will wait for the machine to gracefully
# halt when vagrant halt is called. Defaults to 60 seconds.
config.vm.graceful_halt_timeout = 60
# The guest OS that will be running within this machine.
# This defaults to :linux, and Vagrant will auto-detect the proper distro.
# Vagrant needs to know this information to perform some guest OS-specific things
# such as mounting folders and configuring networks.
##config.vm.guest = 'linux'
# The hostname the machine should have. Defaults to nil.
# If nil, Vagrant will not manage the hostname.
# If set to a string, the hostname will be set on boot.
# #config.vm.hostname = "default"
# A message to show after vagrant up.
# This will be shown to the user and is useful for containing instructions
# such as how to access various components of the development environment.
config.vm.post_up_message = "
Good Luck!
"
# Configures network on the machine.
# - Document : https://www.vagrantup.com/docs/networking/
##config.vm.network "public_network", use_dhcp_assigned_default_route: true
config.vm.network "private_network", ip: "192.168.104.20"
# Configures provider-specific configuration, which is used to modify settings
# which are specific to a certain provider.
# If the provider you are configuring does not exist or is not setup on the system
# of the person who runs vagrant up, Vagrant will ignore this configuration block.
#
# This allows a Vagrantfile that is configured for many providers to be shared
# among a group of people who may not have all the same providers installed.
#
# Settings written below is just for Virtualbox.
# - Document : https://www.vagrantup.com/docs/providers/
config.vm.provider 'virtualbox' do |vb|
vb.gui = false
vb.name = $hostname
vb.cpus = 1
vb.memory = 4096
end
# Configures provisioners on the machine, so that software can be automatically
# installed and configured when the machine is created.
# Please see the page on provisioners for more information on how this setting works.
# - Document : https://www.vagrantup.com/docs/provisioning/
##config.vm.provision "shell", privileged: false, path: "init-vagrant.sh"
##config.vm.provision 'basic', type: 'shell', inline: $basic
# Configures synced folders on the machine,
# so that folders on your host machine can be synced to and from the guest machine.
# Please see the page on synced folders for more information on how this setting works.
# - Document : https://www.vagrantup.com/docs/synced-folders/
# #config.vm.synced_folder = ""
# A range of ports Vagrant can use for handling port collisions and such.
# Defaults to 2200..2250.
# #config.vm.usable_port_range = ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment