I've been trying to understand how to setup systems from
the ground up on Ubuntu. I just installed redis onto
the box and here's how I did it and some things to look
out for.
To install:
| # read more at https://terrty.net/2014/ssl-tls-in-nginx/ | |
| # latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf | |
| # security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net | |
| # your nginx version might not have all directives included, test this configuration before using in production against your nginx: | |
| # $ nginx -c /etc/nginx/nginx.conf -t | |
| server { | |
| # public key, contains your public key and class 1 certificate, to create: | |
| # (example for startssl) | |
| # $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null |
| # This will move all images and other Dragonfly assets from your local server file system to Amazon S3. | |
| namespace :dragonfly do | |
| task :migrate_to_s3 => :environment do | |
| # Adjust this line to meet your needs: | |
| { Product => [:image_uid, :other_uid], Page => :image_uid }.each do |klass, col| | |
| puts "Migrating #{klass.table_name}..." | |
| Array(col).each do |col| | |
| klass.where("#{col} != ''").find_each do |instance| | |
| begin |
| #log active record from console | |
| ActiveRecord::Base.logger = Logger.new(STDOUT) |
| # /lib/systemd/system/nginx.service | |
| [Unit] | |
| Description=The NGINX HTTP and reverse proxy server | |
| After=syslog.target network.target remote-fs.target nss-lookup.target | |
| [Service] | |
| Type=forking | |
| PIDFile=/opt/nginx/logs/nginx.pid | |
| ExecStartPre=/opt/nginx/sbin/nginx -t |
| json ~1.7 - gem install bundler -v '= 1.5.1' |
| cd / | |
| for i in $( ls ); do | |
| sudo du -sh $i | |
| done |
| description "Puma Background Worker" | |
| start on runlevel [2345] | |
| stop on runlevel [06] | |
| respawn | |
| respawn limit 3 30 | |
| setuid j3ck | |
| setgid j3ck |
| description "Sidekiq Background Worker" | |
| start on runlevel [2345] | |
| stop on runlevel [06] | |
| respawn | |
| respawn limit 3 30 | |
| normal exit 0 TERM | |
| #reload signal USR1 | |
| kill timeout 15 |
| def fib(n) | |
| (2..n).inject( [0, 1] ) { |fib| fib << fib.last(2).reduce(:+) }[n] | |
| end |