Giter Site home page Giter Site logo

deploy's Introduction

Deploy

Super Simple Deploys for side projects and tiny apps.

I've been looking for a good way to deploy simple, small node (and other) projects. This approach is nice since it's all achieved with a couple small bash scripts. But it does require quite a few config files and setting up the system in a certain way.

Which is why so far, I haven't been using this approach myself and instead switched to the awesome https://flynn.io/ - "Throw away the duct tape".

Usage

On your server, you should:

$ apt-get install nodejs nginx
$ npm install -g pm2
$ pm2 startup systemd -u app
$ adduser --disabled-password --gecos "" app
$ adduser app www-data
$ chown -R root:www-data /etc/nginx/conf.d/
$ chmod -R g+rwX /etc/nginx/conf.d/
$ echo "app ALL=(ALL) NOPASSWD: /usr/sbin/nginx -s reload" > /etc/sudoers.d/app
$ chmod 0440 /etc/sudoers.d/app

Ok, all ready. In your app now, create a deploy.conf:

[production]
user app
host 1.2.3.4
repo [email protected]:KidkArolis/foo.git
path /home/app/foo
ref origin/master
forward-agent yes
post-deploy npm install --production && ./node_modules/.bin/taco-nginx --port 3000 --public /home/app/foo/current/public && pm2 startOrRestart pm2.json --env production

Create a pm2.json:

{
  name: 'foo',
  script: `.`,
  cwd: '/home/app/foo/current',
  merge_logs: true,
  env_production: {
    NODE_ENV: 'production'
  }
}

Add an entry to your ~/.ssh/config for key forwarding:

host 1.2.3.4
  ForwardAgent yes

And

$ npm install --save KidkArolis/deploy
$ ./node_modules/.bin/deploy production setup
$ ./node_modules/.bin/deploy production

Point your DNS to this server 1.2.3.4

And your app should be running at foo.yourdomain.com.

If you want to deploy a toplevel domain, pass --domain yourdomain.com to taco-nginx.

Changes

Differences from http://github.com/tj/deploy:

  • None

Differences from https://github.com/mafintosh/taco-nginx

  • Doesn't run your app, only writes an nginx config file
  • Takes a --public param to point to root for static files
  • Doesn't use sudo for mv /tmp/app.conf /etc/nginx/conf.d/app.conf

deploy's People

Contributors

kidkarolis avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.