Giter VIP home page Giter VIP logo

noleg-stack-with-ftp's Introduction

Simple Node & Git Server Setup Scripts

Assumptions

  • You have already booted your server
  • You have a DNS entry pointing to the server
  • Your sever is running Ubuntu (Tested with 14.04 x64 LTS)
  • You're using linux or osx (windows user can do this but ssh key wise is more complex)

Server Setup

Ssh into your server and run the following command (replace example.com with your domain).

DOMAIN=example.com FTP_USER=max FTP_USER_PASSWORD=password bash <(curl -s https://raw.githubusercontent.com/davidtsuji/noleg-stack-with-ftp/master/init.sh)

Setup SSH Keys

For extra security, the git account doesn't not have password authentication or terminal access so we need to setup a trust between your computer and the server using your computers public key.

If you haven't already done this on your local machine in the past, generate your keys.

ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub | sudo tee -a /home/git/.ssh/authorized_keys

Now send the key to the server so it knows to trust you.

cat ~/.ssh/id_rsa.pub | ssh [email protected] "cat >> /home/git/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh [email protected] "cat >> ~/.ssh/authorized_keys"

You should now be able to ssh into your server without providing a password. Remember this only works on your local computer though.

More information keys can be found at https://help.github.com/articles/generating-ssh-keys

Create and Deploy Your Site

On your local machine do the following to setup a basic site

# Clone the bare git repo from the server
git clone [email protected]:example.com.git
cd example.com

# Generate an express site
sudo npm install -g express-generator
express --force --sessions --css stylus --ejs ./
echo "node_modules" > .gitignore

# Add to git and publish
git commit -am "Initial commit"
git push origin master

Once this runs, you should be able to go to http://example.com and see the website you just created.

Creating New Sites

Now that we are setup, if you want to create another site on the same server all you have to do is one one command on the server.

./setupBasicSite.sh test.foobar.com 3001

Now you can git clone [email protected]:test.foobar.com.git and push your new site.

Don't forget you will have to use port 3001 or you will get conflicts.

Issues

If something didn't work for you, please open a issue on this repo and I'll help you out.

noleg-stack-with-ftp's People

Watchers

 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.