feat(vagrant): add provision script and improve current vagrantfile
This commit is contained in:
Родитель
424076fd9c
Коммит
ed6c928a8c
|
@ -9,3 +9,6 @@ node_modules
|
|||
pm2
|
||||
dump.rdb
|
||||
*.log
|
||||
|
||||
.vagrant
|
||||
local_config.yaml
|
||||
|
|
|
@ -1,27 +1,51 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
require 'yaml'
|
||||
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
localConfigPath = "local_config.yaml"
|
||||
|
||||
if File.exists?localConfigPath then
|
||||
settings = YAML::load(File.read(localConfigPath))
|
||||
else
|
||||
settings = Hash.new
|
||||
end
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.box = "trusty64"
|
||||
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
|
||||
config.ssh.forward_agent = true
|
||||
config.ssh.insert_key = false
|
||||
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
vb.customize ["modifyvm", :id, "--memory", "1536"]
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.memory = settings["memory"] ||= "1536"
|
||||
end
|
||||
|
||||
config.vm.define "dev", primary: true do |dev|
|
||||
dev.vm.network :private_network, ip: "192.168.50.10"
|
||||
dev.vm.network "private_network", ip: settings["ip"] ||= "192.168.50.10"
|
||||
dev.vm.network "forwarded_port", guest: 1111, host: 1111
|
||||
dev.vm.network "forwarded_port", guest: 1112, host: 1112
|
||||
dev.vm.network "forwarded_port", guest: 1113, host: 1113
|
||||
dev.vm.network "forwarded_port", guest: 1114, host: 1114
|
||||
dev.vm.network "forwarded_port", guest: 3030, host: 3030
|
||||
dev.vm.network "forwarded_port", guest: 5000, host: 5000
|
||||
dev.vm.network "forwarded_port", guest: 5050, host: 5050
|
||||
dev.vm.network "forwarded_port", guest: 8080, host: 8080
|
||||
dev.vm.network "forwarded_port", guest: 9000, host: 9000
|
||||
dev.vm.network "forwarded_port", guest: 9010, host: 9010
|
||||
dev.vm.network "forwarded_port", guest: 9011, host: 9011
|
||||
dev.vm.network "forwarded_port", guest: 10137, host: 10137
|
||||
dev.vm.network "forwarded_port", guest: 10139, host: 10139
|
||||
dev.vm.network "forwarded_port", guest: 10140, host: 10140
|
||||
end
|
||||
|
||||
config.push.define "atlas" do |push|
|
||||
push.app = "vladikoff/fxa-local-dev"
|
||||
push.dir = "."
|
||||
config.vm.provision "shell", privileged: false, path: "_scripts/vagrant_provision.sh", args: Vagrant::Util::Platform.windows?.to_s.upcase
|
||||
|
||||
if settings.has_key?("push.app") then
|
||||
config.push.define "atlas" do |push|
|
||||
push.app = settings["push.app"]
|
||||
push.dir = settings["push.dir"] ||= "."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
echo "### Adding Java and Node.js repositories ###"
|
||||
sudo add-apt-repository -y ppa:webupd8team/java
|
||||
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
|
||||
|
||||
echo "### Installing dependencies ###"
|
||||
sudo apt-get install -y build-essential git-core libgmp3-dev graphicsmagick redis-server python-virtualenv python-dev
|
||||
|
||||
echo "### Installing Node.js ###"
|
||||
sudo apt-get install -y nodejs
|
||||
|
||||
echo "### Checking if npm is older than 2.4 ###"
|
||||
if [[ $(npm -v | awk '{print $1}') < 2.4 ]]; then
|
||||
echo "Updating npm to 2.4"
|
||||
sudo npm install -g npm@2.4
|
||||
fi
|
||||
|
||||
echo "### Accepting Oracle licence and installing Java ###"
|
||||
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
|
||||
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
|
||||
sudo apt-get install -y oracle-java7-installer
|
||||
|
||||
if [ "$1" != "TRUE" ]; then
|
||||
echo "### Installing development environment ###"
|
||||
cd /vagrant; npm install
|
||||
else
|
||||
echo "### You need to manually install development environment ###"
|
||||
fi
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
ip: "192.168.50.10"
|
||||
|
||||
memory: 1536
|
||||
|
||||
#push.app:
|
||||
#push.dir:
|
25
servers.json
25
servers.json
|
@ -25,14 +25,15 @@
|
|||
"script": "bin/key_server.js",
|
||||
"cwd": "fxa-auth-server",
|
||||
"env": {
|
||||
"NODE_ENV": "dev"
|
||||
"NODE_ENV": "dev",
|
||||
"IP_ADDRESS": "0.0.0.0"
|
||||
},
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m"
|
||||
},
|
||||
{
|
||||
"name": "content-server PORT 3030",
|
||||
"script": "node_modules/.bin/grunt",
|
||||
"script": "node_modules/grunt-cli/bin/grunt",
|
||||
"args": ["server"],
|
||||
"cwd": "fxa-content-server",
|
||||
"env": {
|
||||
|
@ -60,7 +61,8 @@
|
|||
"script": "bin/server.js",
|
||||
"cwd": "fxa-oauth-server",
|
||||
"env": {
|
||||
"NODE_ENV": "dev"
|
||||
"NODE_ENV": "dev",
|
||||
"HOST" : "0.0.0.0"
|
||||
},
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m"
|
||||
|
@ -70,7 +72,8 @@
|
|||
"script": "bin/internal.js",
|
||||
"cwd": "fxa-oauth-server",
|
||||
"env": {
|
||||
"NODE_ENV": "dev"
|
||||
"NODE_ENV": "dev",
|
||||
"HOST_INTERNAL" : "0.0.0.0"
|
||||
},
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m"
|
||||
|
@ -81,7 +84,8 @@
|
|||
"cwd": "fxa-profile-server",
|
||||
"max_restarts": "1",
|
||||
"env": {
|
||||
"NODE_ENV": "dev"
|
||||
"NODE_ENV": "dev",
|
||||
"HOST": "0.0.0.0"
|
||||
},
|
||||
"min_uptime": "2m"
|
||||
},
|
||||
|
@ -101,7 +105,8 @@
|
|||
"cwd": "fxa-profile-server",
|
||||
"max_restarts": "1",
|
||||
"env": {
|
||||
"NODE_ENV": "dev"
|
||||
"NODE_ENV": "dev",
|
||||
"WORKER_HOST": "0.0.0.0"
|
||||
},
|
||||
"min_uptime": "2m"
|
||||
},
|
||||
|
@ -132,7 +137,8 @@
|
|||
"script": "bin/server.js",
|
||||
"cwd": "fxa-oauth-console",
|
||||
"env": {
|
||||
"NODE_ENV": "dev"
|
||||
"NODE_ENV": "dev",
|
||||
"HOST": "0.0.0.0"
|
||||
},
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m"
|
||||
|
@ -142,10 +148,11 @@
|
|||
"script": "server.js",
|
||||
"cwd": "browserid-verifier",
|
||||
"env": {
|
||||
"PORT": "5050"
|
||||
"PORT": "5050",
|
||||
"IP_ADDRESS": "0.0.0.0"
|
||||
},
|
||||
"max_restarts": "1",
|
||||
"min_uptime": "2m"
|
||||
"min_uptime": "2m"
|
||||
},
|
||||
{
|
||||
"name": "sync server PORT 5000",
|
||||
|
|
Загрузка…
Ссылка в новой задаче