When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
var Article = require('../../../models/article');
Those suck for maintenance and they're ugly.
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
# This shows the setup for two services, an accounts service which connects to a database and a pagerduty service which connects to the pagerduty api | |
# Directory structure | |
accounts/ | |
|_ Dockerfile | |
pagerduty/ | |
|_ Dockerfile | |
nginx/ | |
|_ conf/ | |
|_ sites.conf | |
|_ .htpasswd |
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
sudo -u postgres psql -tAc "CREATE DATABASE jerry;" | |
sudo -u postgres psql -tAc "GRANT ALL PRIVILEGES ON DATABASE jerry to tom;" |
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
sudo apt-get install python-pip -y | |
sudo pip install -U docker-compose==1.4.0 |
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
o := orm.NewOrm() | |
//Database alias | |
name := "default" | |
// Drop table and re-create. | |
force := true | |
// Print log. | |
verbose := true | |
err := orm.RunSyncdb(name, force, verbose) //this is to create/drops the tables | |
if err != nil { | |
beego.Info(err) |
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
FROM node:4 | |
# Add code & set working dir | |
ADD . /app | |
WORKDIR /app | |
# Install npm package | |
RUN npm install |
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
# install brikis98/docker-osx-dev | |
curl -o /usr/local/bin/docker-osx-dev https://raw.githubusercontent.com/brikis98/docker-osx-dev/master/src/docker-osx-dev | |
chmod +x /usr/local/bin/docker-osx-dev | |
docker-osx-dev install | |
# go to working folder where contains docker-compose.xml | |
docker-osx-dev | |
# install virtualenv | |
sudo pip install virtualenv |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.provider "virtualbox" do |v| | |
v.memory = 2048 | |
v.cpus = 1 |
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
docker-machine \ | |
--tls-ca-cert $LOCAL_CONFIG_PATH/ca.pem \ | |
--tls-ca-key $LOCAL_CONFIG_PATH/ca-key.pem \ | |
--tls-client-cert $LOCAL_CONFIG_PATH/cert.pem \ | |
--tls-client-key $LOCAL_CONFIG_PATH/key.pem \ | |
create --driver generic --generic-ssh-user root --generic-ip-address xxx.xxx.xxx.xxx test-deployment |
OlderNewer