Skip to content

Instantly share code, notes, and snippets.

@jfgomez86
Last active December 10, 2015 13:59
Show Gist options
  • Save jfgomez86/4444681 to your computer and use it in GitHub Desktop.
Save jfgomez86/4444681 to your computer and use it in GitHub Desktop.
Most basic server setup checklist for newbs. This list will start growing...hopefully.
# Bundler Integration
# http://github.com/carlhuda/bundler/blob/master/lib/bundler/capistrano.rb
require 'bundler/capistrano'
# Application Settings
set :application, "washa"
set :user, "www"
set :deploy_to, "/home/#{user}/#{application}/web"
set :rails_env, "production"
set :use_sudo, false
set :keep_releases, 5
# Git Settings
set :scm, :git
set :branch, "master"
set :repository, "[email protected]:jfgomez86/washa.git"
set :deploy_via, :remote_cache
# Uses local instead of remote server keys, good for github ssh key deploy.
ssh_options[:forward_agent] = true
# Server Roles
role :web, "washa.tv"
role :app, "washa.tv"
role :db, "washa.tv", :primary => true
# Passenger Deploy Reconfigure
namespace :deploy do
desc "Restart passenger process"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "#{t} does nothing for passenger"
task t, :roles => :app do ; end
end
end
namespace :config do
desc "Configure database.yml"
task :database, :roles => :app, :except => {:no_release => true} do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
desc "Configure for rails 3 asset pipeline"
task :assets, :roles => :app, :except => {:no_release => true} do
run "cd #{release_path} && rake assets:precompile"
end
end
after 'deploy:update_code', 'config:database', 'config:assets'

Web Server

a. Server: Basically a computer connected to a network with a specific purpose.

Things you'll need:

  1. A Remote Computer

    a. A VPS is a solid choice for most b. Your own garage server c. Even your cellphone might be setup as a server

  2. Operating System

a. You need to choose the right Distribution for the right Job

  1. Processor

a. Virtualized? b. Dedicated Processing c. Distributed Processing

  1. Geographical location

Sub Checklist for a Web app

Once you've got your box setup, these are the things you need to make sure you do:

a. Assuming a Linode: Ubuntu server 12.04 / 512 MB RAM / x86

  1. Make sure you know how to SSH access to your server

a. You'll most likely be root (which is kind of bad for a newb). Keep that in mind!

  1. Create a Non-priviledged User by leveraging the tools available on your distro

a. On Ubuntu you'll surely have access to adduser. Run something like:

adduser deploy
  1. Edit the /etc/sudoers file

a. Make sure you add your user's group to the allowed shudders. b. If you feel lost, try man sudoers

  1. Setup the web server

a. Install any Web Framework libraries, such as rails, php, python, etc. b. Install web server software. Common choices are: Apache, Nginx, Lighttpd, etc.

-. You should also install any framework specific module to your web server. In *rails'* case: Passenger, Mongrel, Thin, Unicorn, Puma, etc.

c. Web App Dependencies. bundler, postgresql if hosting the database on the same server, or anything else that's required to run the app.

    • Deployment workflow

a. This is optional, but a best practice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment