-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inital Vagrant box config for dev (Issue #10)
Provisions a 2GB 2CPU debian box w/ Docker, jq, httpie, and node 8.4, and yarn This doesn't quite give a fullly working dev setup yet, to be done: - re: issue #2, merge backend/api/docker-compose into backend/docker-compose - create local https certs or move dev server to non-https port - forward correct ports to host machine
- Loading branch information
1 parent
f18934f
commit ee1b010
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vagrant/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure(2) do |config| | ||
config.vm.box = "bas/contrib-stretch64" | ||
config.vm.box_version = "9.0.0" | ||
config.vm.network "private_network", ip: "192.168.10.10" | ||
config.vm.synced_folder ".", "/hrs.plus" | ||
config.vm.define "hrs" do |hrs| | ||
end | ||
config.vm.provision "shell", path: "bin/provision.sh", privileged: true | ||
|
||
config.vm.provider "virtualbox" do |v| | ||
v.memory = 2048 | ||
v.cpus = 2 | ||
end | ||
|
||
config.vm.network "forwarded_port", guest: 8888, host: 8888 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
# must be run as root | ||
# portions cribbed from codeforhawaii/aclu/provision-debian.sh | ||
|
||
set -e # stop bash execution on on first error | ||
set -x # echo bash commands before execution, useful for debugging | ||
|
||
NODE_VERSION=8.4.0 # latest Node version as of 15-Aug-2017 | ||
JQ_VERSION=1.5 # latest jq version as of 15-Aug-2015 | ||
DOCKER_COMPOSE_VERSION=1.16.0-rc2 | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y \ | ||
git \ | ||
httpie | ||
|
||
# install ./jq (https://stedolan.github.io/jq/) | ||
sudo wget -qO /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 | ||
sudo chmod a+x /usr/local/bin/jq | ||
|
||
# nuke any previous versions of node in /usr/local/node | ||
sudo rm -rf /usr/local/node-*-linux-x64 /usr/local/node | ||
|
||
# donwnload and unpack node into /usr/local | ||
cd /usr/local | ||
wget -qO- https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz | sudo tar xvJ | ||
sudo ln -s /usr/local/node-v${NODE_VERSION}-linux-x64 /usr/local/node | ||
|
||
# install yarn | ||
sudo env "PATH=/usr/local/node/bin/:${PATH}" npm install -g yarn | ||
|
||
# remove previous docker | ||
apt-get remove docker docker.io | ||
|
||
# install latest docker | ||
wget -qO- https://get.docker.com/ | sudo sh | ||
|
||
# remove previous docker-compose | ||
rm -rf /usr/local/bin/docker-compose | ||
# download latest docker-compose | ||
wget -qO /usr/local/bin/docker-compose https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 | ||
chmod a+x /usr/local/bin/docker-compose | ||
|
||
# Linux kernel settings for ElasticSearch | ||
# https://www.elastic.co/guide/en/elasticsearch/reference/5.5/docker.html#docker-prod-prerequisites | ||
echo "vm.max_map_count=262144" >> /etc/sysctl.conf | ||
sysctl -w vm.max_map_count=262144 | ||
|
||
|
||
sudo sg vagrant <<\DEVOPS_BLOCK | ||
cd /hrs.plus/backend | ||
docker-compose build | ||
docker-compose up -d | ||
DEVOPS_BLOCK | ||
|