rails-ahoy 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faafba237f26ce756cdc2110a568c9b8f08dd3be
|
4
|
+
data.tar.gz: 5a7466efa90fb1ba813b85b5d60e38711e8f506f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7842899265c3eaa0384efaca34c21e9a4d66025102920648f0bd57b6fb15a859b8553deef370948e1f59826f8e401f943b35d3bb2bde3d815cfd4b55f104bd42
|
7
|
+
data.tar.gz: 2e5795d4f3c60976fc6a3653437a406fc1abb62a9334ad219875742c72984466268fcd8fb2ace5c48b8a0b7f5841bfbdcd644cff53047ed25545257536b732ce
|
data/README.md
CHANGED
@@ -1,30 +1,120 @@
|
|
1
|
-
|
1
|
+
``` html
|
2
2
|
|
3
|
-
|
3
|
+
___ ___ ___ ___
|
4
|
+
/ /\ /__/\ / /\ /__/|
|
5
|
+
/ /++\ \ \+\ / /++\ | |+|
|
6
|
+
/ /+/\+\ \__\+\ / /+/\+\ | |+|
|
7
|
+
/ /+/~/++\ ___ / /++\ / /+/ \+\ | |+|
|
8
|
+
/__/+/ /+/\+\ /__/\ /+/\+\ /__/+/ \__\+\ ___|__|+|
|
9
|
+
\ \+\/+/__\/ \ \+\/+/__\/ \ \+\ / /+/ /__/+++++\
|
10
|
+
\ \++/ \ \++/ \ \+\ /+/ \__\~~~~++\
|
11
|
+
\ \+\ \ \+\ \ \+\/+/ \ \+\
|
12
|
+
\ \+\ \ \+\ \ \++/ \ \+\
|
13
|
+
\__\/ \__\/ \__\/ \__\/
|
14
|
+
|
15
|
+
Ahoy = Puma + NGINX + Mina + Vagrant + Ansible
|
16
|
+
```
|
17
|
+
|
18
|
+
---
|
19
|
+
|
20
|
+
#### Ahoy will generate everything you need to deploy your Rails application
|
21
|
+
|
22
|
+
* Ansible scripts to provision your server with Nginx, Ruby, PostgreSQL, and recommended security settings (ssh hardening, firewall, fail2ban, etc.)
|
23
|
+
* Mina scripts to deploy your Rails application
|
24
|
+
* Puma application server configuration files
|
25
|
+
* An optional Vagrantfile with settings
|
26
|
+
* An *.env* directory that will use YAML to store your environment variables securely
|
4
27
|
|
5
|
-
## Installation
|
6
28
|
|
7
|
-
|
29
|
+
**IMPORTANT:** Ahoy currently expects that your Rails application is using PostgreSQL. Depending on demand, there may be future support for MySQL.
|
30
|
+
|
31
|
+
## Installation and usage
|
32
|
+
|
33
|
+
**RECOMMENDATION:** You might want to first try this using a fresh Rails application so you can see how it effects your files before running this in your existing code base.
|
34
|
+
|
35
|
+
### Step 1
|
36
|
+
|
37
|
+
Add the gem to your Gemfile and bundle
|
8
38
|
|
9
39
|
```ruby
|
10
|
-
gem 'ahoy'
|
40
|
+
gem 'rails-ahoy'
|
11
41
|
```
|
12
42
|
|
13
|
-
|
43
|
+
$ bundle install
|
44
|
+
|
45
|
+
### Step 2
|
46
|
+
|
47
|
+
Execute the following terminal command to launch Ahoy's interactive guide
|
48
|
+
|
49
|
+
$ rails generate ahoy:init
|
50
|
+
|
51
|
+
Continue to next step AFTER you complete the interactive guide
|
52
|
+
|
53
|
+
### Step 3
|
54
|
+
|
55
|
+
If you don't have a production *secret_key_base*, generate one using:
|
56
|
+
|
57
|
+
$ rake secret
|
58
|
+
|
59
|
+
This will produce something that looks like:
|
60
|
+
|
61
|
+
$ f67395912d0ddd0de80a734822e73b327d007809123...
|
62
|
+
|
63
|
+
Now just copy and paste it into the following file:
|
64
|
+
|
65
|
+
$ <YOUR RAILS APP>/.env/production_env.yml
|
66
|
+
|
67
|
+
**IMPORTANT:** At this point make sure to commit your changes and push them up to your repo!
|
68
|
+
|
69
|
+
### Step 4
|
70
|
+
|
71
|
+
**IMPORTANT:** For this step, you will need a freshly installed Ubuntu box with root ssh privileges. If you're not sure how to do this, contact your web hosting administrator.
|
72
|
+
|
73
|
+
From within your Rails app...
|
74
|
+
|
75
|
+
$ cd config/ansible
|
76
|
+
$ ./production.sh
|
77
|
+
|
78
|
+
Executing `production.sh` will launch the provisioning process and setup your box so it can run Rails using Nginx as the web server, Puma as your application server, and PostgreSQL as your database.
|
79
|
+
|
80
|
+
**NOTE:** This process may take a while (15 mins or so), so sit back and relax.
|
81
|
+
|
82
|
+
### Step 5
|
83
|
+
|
84
|
+
**ASSUMPTION:** This step assumes that your code is hosted in a Github repo.
|
85
|
+
|
86
|
+
Once the provisioning process is complete, log into your box with the server user (ex: deployer)
|
87
|
+
|
88
|
+
$ ssh deployer@<YOUR SERVER IP>
|
89
|
+
|
90
|
+
Once in, get your server user's public key
|
91
|
+
|
92
|
+
$ cat ~/.ssh/id_rsa.pub
|
93
|
+
|
94
|
+
This will print out something like this:
|
95
|
+
|
96
|
+
sh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOv2hw90hySH+41A6NVjp6GXhBS/PUVmTot...
|
97
|
+
|
98
|
+
Copy the public key and paste it into your Rails application Github repo settings to allow SSH access.
|
99
|
+
|
100
|
+
### Step 6
|
101
|
+
|
102
|
+
Go back to the root of your Rails application and execute the following command:
|
103
|
+
|
104
|
+
$ mina production setup
|
14
105
|
|
15
|
-
|
106
|
+
Then...
|
16
107
|
|
17
|
-
|
108
|
+
$ mina production deploy
|
18
109
|
|
19
|
-
|
110
|
+
### Congratulations!
|
20
111
|
|
21
|
-
|
112
|
+
If everything worked as it should have, your Rails application should be up and running on the Web. Enjoy!
|
22
113
|
|
23
|
-
TODO: Write usage instructions here
|
24
114
|
|
25
115
|
## Contributing
|
26
116
|
|
27
|
-
1. Fork it ( https://github.com/[my-github-username]/ahoy/fork )
|
117
|
+
1. Fork it ( https://github.com/[my-github-username]/rails-ahoy/fork )
|
28
118
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
119
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
120
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/ahoy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-ahoy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Pearson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,7 +95,6 @@ files:
|
|
95
95
|
- lib/generators/ahoy/templates/ansible_templates/playbooks/_production.yml
|
96
96
|
- lib/generators/ahoy/templates/ansible_templates/playbooks/_vagrant.yml
|
97
97
|
- lib/generators/ahoy/templates/ansible_templates/playbooks/group_vars/_all.yml
|
98
|
-
- lib/generators/ahoy/templates/ansible_templates/playbooks/group_vars/_production.yml
|
99
98
|
- lib/generators/ahoy/templates/env_templates/_development_env.yml
|
100
99
|
- lib/generators/ahoy/templates/env_templates/_production_env.yml
|
101
100
|
- lib/generators/ahoy/templates/env_templates/_test_env.yml
|
@@ -1,11 +0,0 @@
|
|
1
|
-
---
|
2
|
-
server:
|
3
|
-
user: <%= Ahoy::VariableStore.variables['server_user'] %>
|
4
|
-
ssh_port: <%= Ahoy::VariableStore.variables['server_ssh_port'] %>
|
5
|
-
app:
|
6
|
-
root: <%= Ahoy::VariableStore.variables['app_name'] %>
|
7
|
-
secret_key_base: ea25c34b9d9443935394356303a408d19d5613ccdb77de0bc98c5ac57dcb5d19b53f03f13fd402926778b8f6fe6be81b67d9f206d16f5fe3145b9049a6fee582
|
8
|
-
database:
|
9
|
-
name: <%= Ahoy::VariableStore.variables['database_name'] %>
|
10
|
-
user: <%= Ahoy::VariableStore.variables['database_user'] %>
|
11
|
-
password: <%= Ahoy::VariableStore.variables['database_password'] %>
|