This file contains hidden or 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
# Get the latest packages | |
apt-get -y update | |
# Install curl, git and python properties to be able to add repositories to apt | |
apt-get -y install curl git-core python-software-properties | |
# Install nginx | |
add-apt-repository ppa:nginx/stable #add nginx repo to get the latest version | |
apt-get -y update # update installed packages | |
apt-get -y install nginx # Install the latest stable nginx |
This file contains hidden or 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
require "bundler/capistrano" | |
# Define your server here | |
server "<server>", :web, :app, :db, primary: true | |
# Set application settings | |
set :application, "<app_name>" | |
set :user, "<deployment_user>" # As defined on your server | |
set :deploy_to, "/home/#{user}/apps/#{application}" # Directory in which the deployment will take place | |
set :deploy_via, :remote_cache |
This file contains hidden or 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
upstream unicorn { | |
server unix:/tmp/unicorn.<app_name>.sock fail_timeout=0; | |
} | |
server { | |
listen 80 default deferred; | |
server_name <your_servername>; | |
if ($host = '<your_servername>' ) { | |
rewrite ^/(.*)$ http://<your_servername>/$1 permanent; | |
} |
This file contains hidden or 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
# Define your root directory | |
root = "/home/deployer/apps/gifroll/current" | |
# Define worker directory for Unicorn | |
working_directory root | |
# Location of PID file | |
pid "#{root}/tmp/pids/unicorn.pid" | |
# Define Log paths |
This file contains hidden or 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
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Manage unicorn server | |
# Description: Start, stop, restart unicorn server for a specific application. | |
### END INIT INFO |
This file contains hidden or 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
rails new your_project_name |
This file contains hidden or 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 should go in your model | |
mount_uploader :image, YourUploaderClass |
This file contains hidden or 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
class Image < ActiveRecord::Base | |
attr_accessible :description, :image, :title | |
mount_uploader :image, ImagesUploader | |
end |
This file contains hidden or 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
<%= form_for(@image) do |f| %> |
This file contains hidden or 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
<%= form_for @image, html: { multipart: true } do |f| %> |
OlderNewer