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
# Ruby(2.4.4) Module - SecureRandom - https://ruby-doc.org/stdlib-2.4.4/libdoc/securerandom/rdoc/SecureRandom.html | |
SecureRandom.class_eval do | |
CHARSET = [*"A".."Z", *"0".."9"] | |
# Returns Randomly generated 6 or more char long alphanumeric string | |
def self.alphanumeric(number) | |
CHARSET.sample(number).join | |
end | |
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
## Modify postgresql.conf | |
# Find postgresql.conf | |
# ---- For mac users ---- | |
cd /usr/local/var/postgres/ | |
vi postgresql.conf | |
# ---- For ubuntu users ---- | |
cd /etc/postgresql/<version>/main |
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
## Gemfile | |
gem 'pghero' | |
# pg_query is used by pghero to provide suggestions to add indexes | |
gem 'pg_query', '>= 0.9.0' | |
# bundle install | |
## Add a route to access the pgHero Dashboard | |
# You can secure its access with Devise user authentication |
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
# CentOS 6.5 | |
Install rvm | |
>> curl -L get.rvm.io | bash -s stable | |
>> \curl -sSL https://get.rvm.io | bash | |
>> source /etc/profile.d/rvm.sh | |
>> rvm reload | |
Install Ruby | |
>> rvm install 2.1.2 |
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
Create new Volume (i.e, 30gb) from Panel | |
>> Select volume, Go to Actions/Attach | |
>> Select instance to attach it | |
Mount volume to /mnt | |
>> Create EBS volume. | |
>> Attach EBS volume to /dev/sdf (EC2's external name for this particular device number). | |
>> Format file system /dev/xvdf (Ubuntu's internal name for this particular device number): | |
>> sudo mkfs.ext4 /dev/xvdf | |
>> Only format the file system if this is a new volume with no data on it. Formatting will make it difficult or impossible to retrieve any data that was on this volume previously. |
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
Launch EC2 instance | |
>> Reference - http://dennissuratna.com/rails-deployment-aws2/ | |
Config Security group | |
Make server private - only accessible via NAT | |
>> Select Subnat option while configuring instance | |
Map DNS - link web address - www.foo.com | |
Basic Configuration for EC2 instance | |
>> yum -y update | |
>> yum groupinstall -y 'development tools' |
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
VPC and subnet | |
>> Reference - http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Introduction.html | |
Config VPC - Config Subnet & associate with VPC | |
>> Reference - http://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/getting-started-create-vpc.html | |
NAT (Network Access Translation) instance | |
>> Reference - http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html | |
Config NAT server | |
>> Reference - http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html#NATInstance | |
Define Routing in Subnet |
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
Open bash_profile file | |
>> vi ~/.bash_profile | |
Add Alias in bash_profile file | |
>> alias ssh-nat="ssh -i ~/.ssh/key-pair.pem [email protected]" # Replace with actual server ip | |
Save | |
>> :wq | |
Refresh file | |
>> source ~/.bash_profile | |
Try Alias | |
>> ssh-nat |
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
Each server has .ssh/authorized_keys file | |
Each SSH key has Private & Public key | |
Copy content within Pub key of relevant Private key & paste it in relevant server's .ssh/authorized_keys file | |
>> vi .ssh/test_ssh.pub | |
>> Copy content | |
>> ssh-nat (alias) | |
>> ssh-learn (alias) | |
>> vi .ssh/authorized_keys | |
>> i - Paste content | |
>> :wq - save |
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
# First step to AWS - learn to generate SSH key for servers | |
Generate Key in Mac | |
>> ssh-keygen | |
Give path & key name | |
>> Enter file in which to save the key (/Users/username/.ssh/id_rsa): /Users/username/.ssh/test_ssh | |
Enter password (optional) | |
>> Enter passphrase (empty for no passphrase): | |
>> Enter same passphrase again: | |
"Your identification has been saved in /Users/username/.ssh/test_ssh. |
NewerOlder