based on DigitalOcean guide
Create local project
local$ rails new appname -T -d postgresql
local$ rails g scaffold Story title:string body:text
local$ rails db:migrate
name: Release | |
on: | |
release: | |
types: [created] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: |
based on DigitalOcean guide
Create local project
local$ rails new appname -T -d postgresql
local$ rails g scaffold Story title:string body:text
local$ rails db:migrate
#!/bin/bash | |
echo "==========================================" | |
echo "Set ssh id_rsa to ssh key for gotoinc git acc" | |
echo "==========================================" | |
git config --global --replace-all user.email "[email protected]" | |
git config --global --replace-all user.name "Anton Tkachov" | |
echo "------------------------------------------" | |
echo "User creds" | |
git config --global user.email |
# | |
# Sidekiq auto start using systemd unit file for Ubuntu 16.04 | |
# | |
# Put this in /lib/systemd/system (Ubuntu). | |
# Run: | |
# 1. systemctl enable sidekiq (to enable sidekiq service) | |
# 2. systemctl {start,stop,restart} sidekiq (to start sidekiq service) | |
# | |
# This file corresponds to a single Sidekiq process. Add multiple copies | |
# to run multiple processes (sidekiq-1, sidekiq-2, etc). |
ActiveRecord::Base.connection.tables.each do |table_name| | |
ActiveRecord::Base.connection.reset_pk_sequence!(table_name) | |
end |
I started a project on a Hobby Dev plan (free, limit 10,000 rows), and then later needed to upgrade it to Hobby Basic ($9/month, limit 10,000,000 rows).
After assigning the new database, I had two databases attached to the application. They looked something like this:
# frozen_string_literal: true | |
require "active_support" | |
require "active_support/core_ext/class/attribute_accessors" | |
require "active_support/core_ext/class/attribute" | |
require "active_support/core_ext/hash/indifferent_access" | |
require "active_support/core_ext/kernel/reporting" | |
require "active_support/core_ext/module/delegation" | |
require "active_support/core_ext/module/aliasing" | |
require "active_support/core_ext/object/blank" |
echo "==========================================" | |
echo "Set ssh id_rsa(sample desc)" | |
echo "==========================================" | |
git config --global --replace-all user.email "[email protected]" | |
git config --global --replace-all user.name "GITHUB NAME" | |
echo "------------------------------------------" | |
echo "User creds" | |
git config --global user.email | |
git config --global user.name |
rescue => error | |
Rails.logger.error(error) | |
Rails.logger.error(error.message) | |
Rails.logger.error(error.backtrace.join("\n")) |
namespace :db do namespace :seed do | |
Dir[Rails.root.join('db', 'seeds', '*.rb')].each do |filename| | |
task_name = File.basename(filename, '.rb') | |
desc "Seed #{task_name}, based on the file with the same name in `db/seeds/*.rb`" | |
task task_name.to_sym => :environment do | |
load(filename) if File.exist?(filename) | |
end | |
end | |
end | |
end |