###Sketch trial non stop
Open hosts files:
$ open /private/etc/hosts
Edit the file adding:
127.0.0.1 backend.bohemiancoding.com
127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com
| # A simple function to return a signed, expiring url for Amazon Cloudfront. | |
| # As it's relatively difficult to figure out exactly what is required, I've posted my working code here. | |
| # This will require openssl, digest/sha1, base64 and maybe other libraries. | |
| # In my rails app, all of these are already loaded so I'm not sure of the exact dependencies. | |
| module CloudFront | |
| def get_signed_expiring_url(path, expires_in, private_key_filename, key_pair_id) | |
| # AWS works on UTC, so make sure you are not using local time |
| # dump | |
| pg_dump testdb | pv -c -s $(psql -tc "SELECT pg_database_size('testdb')") -N dump | gzip > testdb.sql.gz | |
| # restore | |
| pv testdb_20120501.sql.gz | zcat | psql testdb |
| require "active_record" | |
| namespace :db do | |
| db_config = YAML::load(File.open('config/database.yml')) | |
| db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'}) | |
| desc "Create the database" | |
| task :create do | |
| ActiveRecord::Base.establish_connection(db_config_admin) |
| source 'https://rubygems.org' | |
| # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
| gem 'rails', '4.0.3' | |
| gem 'sqlite3' | |
| gem "rmagick" | |
| gem "carrierwave" | |
| gem "fog" |
| # Caddyfile | |
| localhost:2015 { | |
| startup "go run ./server.go" & | |
| root ./static_files | |
| proxy / localhost:2016 | |
| } | |
| # FILE TREE | |
| # |
###Sketch trial non stop
Open hosts files:
$ open /private/etc/hosts
Edit the file adding:
127.0.0.1 backend.bohemiancoding.com
127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com
| - name: DO | |
| hosts: localhost | |
| vars: | |
| project_name: "PUT A NAME FOR YOUR PROJECT HERE" | |
| do_token: "PUT YOUR DIGITAL OCEAN API KEY HERE ==> https://cloud.digitalocean.com/settings/api/tokens" | |
| repository: "PUT YOUR REPOSITORY URL HERE" | |
| tasks: | |
| - name: LOCAL | Generate SSH key | |
| shell: ssh-keygen -b 2048 -t rsa -f ~/.ssh/{{project_name}} -q -N "" |
| def result_handler(result) | |
| case result | |
| when Success, Some | |
| puts 'success, user created' | |
| when Failure { |message, _| message == :http_error } | |
| puts "HTTP request error, #{result.failure[2]}" | |
| when Failure { |message, _| message == :validation_error } | |
| puts "validation error, #{result.failure[2]}" | |
| when Failure(ROM::Error) | |
| puts 'User not created' |
| ### DigitalOcean Ubuntu 18.04 x64 + Rails 5 + Nginx + Unicorn + PostgreSQL9.6 + Capistrano 3 | |
| SSH into Root | |
| $ ssh root@123.123.123.123 | |
| Change Root Password | |
| $ passwd |
| <%= form_with(model: billboard) do |form| %> | |
| <%= tag.div class: "dropzone", data: { controller: "dropzone", dropzone_param_name_value: "billboard[images][]", dropzone_url_value: rails_direct_uploads_url, dropzone_accepted_files_value: "image/*", dropzone_max_files_value: 3, dropzone_max_filesize_value: 0.300 } do %> | |
| <div class="dz-default dz-message flex flex-col items-center"> | |
| <%= image_tag "upload.svg", size: 28, class: "colorize-black", aria: { hidden: true } %> | |
| <h5 class="font-semibold mbs-4">Drop files here or click to upload.</h5> | |
| <p class="text-sm text-subtle">Upload up to 10 files.</p> | |
| </div> | |
| <% end %> | |
| <div class="inline-flex items-center mbs-2 mie-1"> |