@jjmerelo
package.json
{
"name": "hiffeitor",
"scripts": {
"test": "mocha",
"start": "./callback-ea-HIFF.js"
},
"dependencies": {
"nodeo": "^0.2.1",
"winston": "^2.2.0",
"winston-logstash": "^0.2.11",
"winston-papertrail": "^1.0.2"
},
"devDependencies": {
"flightplan": "^0.6.14"
}
}
docker
docker pull jjmerelo/cloudy-ga
Dockerfile
FROM phusion/baseimage
MAINTAINER JJ Merelo "jjmerelo@gmail.com"
RUN echo "Building a docker environment for NodEO"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install apt-utils -y
[... more stuff ... ]
ADD https://github.com/JJ/cloudy-ga/raw/master/app/hiff.json app
WORKDIR /app
RUN npm i
RUN chmod +x callback-ea-HIFF.js
CMD npm start
sudo docker build --no-cache -t jjmerelo/cloudy-ga:0.0.1
sudo docker run -t jjmerelo/cloudy-ga:0.0.1
-e "PAPERTRAIL_PORT=7777"
-e "PAPERTRAIL_HOST=logs77.papertrailapp.com"
- hosts: "{{target}}"
tasks:
- name: install prerrequisites
command: apt-get update -y && apt-get upgrade -y
- name: install packages
apt: pkg={{ item}}
with_items:
- git
- npm
- name: Create profile
copy: content="export PAPERTRAIL_PORT={{PAPERTRAIL_PORT}}"
dest=/home/cloudy/.profile
FlightPlan
plan.target('azure', {
host: 'cloudy-ga.cloudapp.net',
username: 'azureuser',
agent: process.env.SSH_AUTH_SOCK
});
// Local
plan.local(function(local) {
local.echo('Plan local: push changes');
local.exec('git push');
});
plan.remote(function(remote) {
remote.log('Pull');
remote.with('cd cloudy-ga',function() {
remote.exec('git pull');
remote.exec('cd app;npm install .');
});
remote.with('cd /home/azureuser/cloudy-ga/app',function() {
remote.exec('npm start');
});
});
Vagrant
for orchestrationVagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get upgrade -y
SHELL
config.vm.provision "main", type: "ansible" do |ansible|
ansible.extra_vars = { target: "all" }
ansible.playbook = "playbook.yml"
end
# and the rest...
end
@jjmerelo
flic.kr/p/5omH5r
flic.kr/p/8NDCRh
flic.kr/p/5Pa7ZJ
flic.kr/p/4QiGQV
flic.kr/p/8yZyBF
flic.kr/p/6K3ZAG
flic.kr/p/nXfbQ6
https://flic.kr/p/a9SSm3
.