Goals of this tutorial:
- deploy a new Rails app with capistrano
- make it fast (total process takes less than 5 minutes)
- make it simple (no unecessary config)
- manual ssh to the server not required
Rails application stack:
- nginx
- unicorn
- postgresql
| #!/bin/bash | |
| # | |
| # This script will create a 'backend.md' and 'frontend.md' containing | |
| # all the source code in the current directory. You can then upload these | |
| # files to a custom GPT. It's setup for my golang project but you can easily | |
| # modify it to suit your needs. | |
| # | |
| # This script requires 'fd' to be installed. | |
| set -e |
| File.open("my_db", "w") do |f| | |
| ActiveRecord::Base.connection.tables.sort.each do |table_name| | |
| f.write "#{table_name}\n" | |
| ActiveRecord::Base.connection.columns(table_name).map(&:name).sort.each do |c| | |
| f.write "- #{c}\n" | |
| end | |
| end | |
| end |
| [Unit] | |
| Description=Puma Rails Server | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| User=deploy | |
| WorkingDirectory=/home/deploy/apps/app/current | |
| ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/apps/app/shared/puma.rb | |
| ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/apps/app/shared/tmp/pids/puma.state stop |
| [Unit] | |
| Description=delayed_job | |
| After=network.target | |
| After=syslog.target | |
| After=postgresql.target | |
| [Service] | |
| Type=forking | |
| User=deploy | |
| Environment=RAILS_ENV=production |
Goals of this tutorial:
Rails application stack:
This is primarily for my own record and knowledge. If it helps you, great! If it breaks something, don't say I didn't warn you - this is just documentation of what I did to get this to work at the time I wrote this on one particular machine.
c:\cygwin64 (possible in 32-bit too, I just messed up that install and it no longer works, so these were tested on my machine in a 64-bit install). I use my Cygwin setup scripts to simplify this part.| // ================================================== | |
| // RSS tracking stations. | |
| // Red: Uncategorized | |
| // Green: ESTRACK / DSA | |
| // Blue: DSN | |
| // Yellow: Launch sites | |
| // Magenta: MSFN | |
| // The methodology for range here is game-y, but then RT2 is game-y to begin with. |
| @KSCSWITCHER:FOR[RealSolarSystem] | |
| { | |
| // Please keep this list alphabetically sorted. | |
| // The launch sites in this list are historical or planned orbital launch sites. | |
| // Launch site displayName should be [ISO 3166-1 alpha-2 code of current country] - Common Name, | |
| // For technical reasons unicode support is poor; site names in non-latin scripts should be given their | |
| // traditional English name, or if none exists, the English romanization of their name. | |
| // Examples: | |
| // FR - Kourou, not FR - Centre Spatial Guyanais (full name), | |
| // DZ - Hammaguir, not FR - Hammaguir (former country), DZ - Centre interarmées d'essais d'engins spéciaux de Hammaguir B2 (full name) |
| { | |
| "id": "[email protected]", | |
| "label": "folha", | |
| "url": "^https?://www1\\.folha\\.uol\\.com\\.br/.*$", | |
| "dynamic": false, | |
| "allCommentsSelector": "#articleComments", | |
| "commentContainerSelector": ".comment_li", | |
| "commentTextSelector": "p" | |
| } |
| require 'cgi' | |
| require 'digest/md5' | |
| require 'net/https' | |
| require 'uri' | |
| module Jekyll | |
| class GistTag < Liquid::Tag | |
| def initialize(tag_name, text, token) | |
| super | |
| @text = text |