roro 0.2.4 → 0.2.5

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
  SHA256:
3
- metadata.gz: 639ba3036903d8a486608ec5b07f79bf4330e05823b21d7eab7f9f3fde803c62
4
- data.tar.gz: 06bb7ab5697e76eba09a77586b21eb213352df9fd971662ee893c211ed364ae1
3
+ metadata.gz: 999f9916a8bcac4281835fbec6b843e19436b62c43e103945a9e5ebcf09d741e
4
+ data.tar.gz: f6484791b8829df9c2d8a776a86e9ec4e1b0e1afba35cd92df60ab73faced09b
5
5
  SHA512:
6
- metadata.gz: 72b53d0e0cd9cf98914a9dc00921106fbfd68b2ab5452608722a3ee090bc384e74b8e275f5034480fa9f99667fac10912ae4e6c6a2004be28bcf317ddd5f5809
7
- data.tar.gz: 7afa2da9a34364e493457d239ddff73b9791ad519993237fcc779140d90f21d6edd31c91de6878af66896df6a8907bf160bc8104d082ab4e937558c7bdb014ae
6
+ metadata.gz: c136c9d690376e0d82e6f79e71a2485854b77caf640e81b634509e336f0a1f4b3a615e7ff84982b4008bacb9bdbfa33107b42b28ab1b04052dcfc1bd51c4bf9f
7
+ data.tar.gz: 46087ecabf31acd42ddc93922518053279ec1519488919608a658e38c2491d9ed498fba1d56b7f68e603dcea4c410b7775f9b7d78ac0d9f5a79773b222fcf7a9
data/README.md CHANGED
@@ -1,16 +1,23 @@
1
- # Roro
1
+ # RoRo
2
2
 
3
- Roro gives developers a handsome way to create, test, integrate, and deploy Ruby on Rails applications using Guard, CircleCI, Docker, Docker Compose.
3
+ RoRo is a containerization and continuous integration framework for Ruby applications. Like Rails, it favors convention over configuration. It aims to provide everything you need to:
4
4
 
5
- ## Installation
5
+ 1. Greenfield a Rails app in its own container that can talk to a separate Postgresql container.
6
+ 2. Containerize your existing application and database in development.
7
+ 3. Run your tests with Guard in a separate container.
8
+ 4. Roll your containers onto CircleCI for testing.
9
+ 5. Roll your containers off of CircleCI to your servers.
6
10
 
11
+ ## Getting started
12
+
13
+ ### Install
14
+
15
+ RoRo can be installed
7
16
  ```bash
8
17
  $ gem install roro
9
18
  ```
10
19
 
11
- ## Usage
12
-
13
- Once installed, Roro provides a CLI:
20
+ Once installed, RoRo provides a CLI:
14
21
 
15
22
  ```bash
16
23
  $ roro --help
@@ -25,84 +32,134 @@ Commands:
25
32
  roro ruby_gem # Generate files for containerized gem testing, Circle...
26
33
  ```
27
34
 
28
- ## Installing Docker and Docker Compose
35
+ However to use RoRo
36
+
37
+
38
+ ### Docker and Docker Compose
29
39
 
30
- Before using Roro's 'greenfield' and 'rollon' commands, you'll need Docker and Docker Compose. To see if Docker is installed:
40
+ You'll need [Docker](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/). To confirm Docker is installed:
31
41
 
32
42
  ```bash
33
43
  $ docker -v
34
44
  Docker version 18.03.1-ce, build 9ee9f40
35
45
  ```
36
46
 
37
- Instructions for installing [Docker](https://docs.docker.com/install/). To see if Docker Compose is installed:
47
+ To confirm Docker Compose is installed:
38
48
 
39
49
  ```bash
40
50
  $ docker-compose -v
41
51
  docker-compose version 1.21.0, build 5920eb0
42
52
  ```
43
53
 
44
- Instructions for installing [Docker Compose](https://docs.docker.com/compose/install/).
45
-
46
- ## Greenfielding a dockerized app:
54
+ ### Greenfielding a dockerized app
47
55
 
48
56
  ```bash
49
57
  $ mkdir -p handsome_app
50
58
  $ cd handsome_app
51
59
  $ roro greenfield
52
- $ docker-compose up
53
60
  ```
54
61
 
55
- You should now be able to see the Rails welcome screen upon clicking [http://localhost:3000/](http://localhost:3000/).
62
+ It'll take a few minutes for Docker to download your images, copy your files, and build your application but once finished, you'll see the Rails welcome screen at [http://localhost:3000](http://localhost:3000/).
56
63
 
57
- If you're on a linux machine and run into issues, please see the
58
- [linux notes](#linux-notes).
64
+ ### Rolling onto an existing app
59
65
 
66
+ Whether using your own app or one greenfielded using instructions above, first shut down any running docker containers:
60
67
 
61
- ### Rolling onto an existing app:
68
+ ```bash
69
+ $ docker-compose down
70
+ ```
62
71
 
63
- Using your own app or one generated using the 'greenfield' instructions above:
72
+ Then, roll RoRo on:
64
73
 
65
74
  ```bash
66
- $ docker-compose down
67
75
  $ roro rollon
68
- $ docker-compose up
69
76
  ```
70
77
 
71
- You should now be able to see the Rails welcome screen upon clicking [http://localhost:3000/](http://localhost:3000/).
78
+ If your host machine runs a flavor of linux, ensure its logged in user owns the generated files:
79
+
80
+ ```bash
81
+ $ sudo chown <username><user group> -R .
82
+ ```
83
+
84
+ And spin it up:
72
85
 
73
- ## Securing environment files
86
+ ```bash
87
+ $ docker-compose up --build
88
+ ```
74
89
 
75
- Roro gives provides conventions for securing your environment files. To store a variable for use in your development environment, create a file with that variable, name it "development.env," and store it in docker/env_files like so:
90
+ As with greenfielding above, wait a few minutes, and when it's finished, open [http://localhost:3000/](http://localhost:3000/).
91
+
92
+
93
+ ### Guard and tests
94
+
95
+ From another terminal:
96
+
97
+ ```bash
98
+ $ docker-compose exec app bundle exec guard
99
+ ```
100
+
101
+ To use LiveReoload with Guard, install the Chrome [extension](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei?hl=en):
102
+
103
+
104
+ ## Deployment
105
+
106
+ ### Securing environment files
107
+
108
+ Roro provides conventions for securing sensitive variables between docker containers and environments. To store a variable for use in development, create a file with that variable inside, name it "development.env," and store it in docker/env_files. Here's a one-liner:
109
+
110
+ ```bash
111
+ $ echo "export EXAMPLE_KEY=example_value" > docker/env_files/development.env
112
+ ```
113
+
114
+ Next, generate a key for the development environment:
76
115
 
77
116
  ```bash
78
- $ echo "export export EXplace to put environment files for use in dockerized environments. AMPLE_KEY=example_value" > docker/env_files/development.env
79
117
  $ roro generate_key development
118
+ ```
119
+
120
+ Then encrypt the development.env file using the previously generated development key:
121
+
122
+ ```bash
80
123
  $ roro obfuscate development
81
124
  ```
82
125
 
83
- You should now see an environment file and its encrypted counterpart in docker/env_files:
126
+ You should now have the environment file and its encrypted counterpart:
84
127
 
85
128
  ```bash
86
129
  $ ls docker/env_files
87
130
  development.env development.env.enc
88
131
  ```
89
132
 
90
- To expose a previously obfuscated file:
133
+ To see how decryption works, first back up a copy of your development.env file:
91
134
 
92
135
  ```bash
93
136
  $ mv docker/env_files/development.env docker/env_files/backup.env
137
+ ```
138
+
139
+ Then expose its encrypted counterpart:
140
+
141
+ ```bash
94
142
  $ roro expose development
95
143
  ```
96
144
 
97
- To verify the newly decrypted file contents match its backup:
145
+ You should now have three files:
146
+
147
+ ```bash
148
+ $ ls docker/env_files
149
+ backup.env development.env development.env.enc
150
+ ```
151
+
152
+ To verify the newly decrypted file's contents match those of its backup:
98
153
 
99
154
  ```bash
100
155
  $ diff docker/env_files/development.env docker/env_files/backup.env
101
156
  ```
102
157
 
103
- ## Linux notes
158
+ ## Notes
104
159
 
105
- If you're on a linux machine, you may need to change ownership of the newly created files:
160
+ ### Linux
161
+
162
+ If you're running linux you may need to change ownership of the newly created files, prepend commands with sudo, or both. To change ownership of newly generated files:
106
163
 
107
164
  ```bash
108
165
  $ sudo chown <username><user group> -R .
@@ -110,34 +167,54 @@ $ sudo chown <username><user group> -R .
110
167
 
111
168
  If that doesn't work, Docker's [documentation](https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user) should get you pointed in the right direction.
112
169
 
113
- ## Troubleshooting
170
+ ### Troubleshooting
171
+
172
+ #### Port in use
114
173
 
115
- Sometimes the port is in use. This could be because you have a server running on your host machine, or because Docker is running a server and piping it to the host. To shut down a server running in Docker, do:
174
+ Sometimes you will ge a message saying the port specified in your docker-compose.yml file is already in use. This may be because you have a server running on your host from normal development, or because another Docker container is running a server and piping it to your host. If the former you can shut it down using ctrl^c, and if the latter:
116
175
 
117
176
  ```
118
177
  $ docker-compose down
119
178
  ```
120
179
 
121
- Sometimes shutting down all servers doesn't work, because Rails still thinks a server is already running, which is usuall because there's a .pid file somewhere.
180
+ Sometimes shutting down all servers isn't enough because a .pid file remains. You can usually remove it with:
122
181
 
182
+ ```bash
123
183
  $ rm /tmp/pids/server.pid
184
+ ```
124
185
 
125
- Sometimes you just need a fresh start. To remove all images, containers, and volumes from your system:
186
+ If that doesn't work, restart your machine.
126
187
 
127
- $ docker system prune -af --volumes
188
+ #### Mismatched ruby versions
128
189
 
129
- ## Contributing
190
+ Sometimes your Gemfile will specify a ruby version which doesn't match the ruby version of the image your container is using. There are three ways to handle this. The first way is to specify an image with the same version of ruby as is in your Gemfile. Open your Dockerfile and change:
130
191
 
131
- This gem and the associated practices are just a way of deploying your application, not the canonical or best way. If you have suggestions on how to make it easier, more secure, quicker or better, please share them. If you have specific ideas, please fork the repo, make your changes, write your tests, and send me a pull request.
192
+ ```
193
+ FROM ruby:2.5
194
+ ```
195
+ to:
196
+ ```
197
+ FROM ruby:2.5.x
198
+ ```
199
+ ...where 2.5.x is the ruby specified in your Gemfile. The second way is to specify the same version of ruby in your app container's image as at the top of your Gemfile:
132
200
 
133
- ## License
134
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
201
+ ```ruby
202
+ ruby '2.5.x'
203
+ ```
135
204
 
205
+ The third way is to remove the ruby specification from your Gemfile, relying on your Dockerfile for ruby version management.
136
206
 
137
- should get you pointed in the right direction. , you may need to prepend 'sudo' to the above command, or chown newly created files:
207
+ #### Get out of jail
208
+
209
+ To remove all images, containers, and volumes from your system and start over:
138
210
 
139
211
  ```bash
140
- $ sudo chown <username><user group> -R .
212
+ $ docker system prune -af --volumes
141
213
  ```
142
214
 
143
- If that doesn't work, Docker's [documentation](https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user) should get you pointed in the right direction.
215
+ ## Contributing
216
+
217
+ This gem and its associated practices are just one way of using these tools and not the canonical way. My purpose in publishing it is to get a conversation started about what conventions around these tools might look like. If you have ideas on how to make it better please put in an issue -- or fork the repo, make your changes, write your tests, and send me a pull request. It'll make me feel warm inside.
218
+
219
+ ## License
220
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -30,6 +30,7 @@ services:
30
30
 
31
31
  database:
32
32
  image: postgres
33
+
33
34
  env_file:
34
35
  - docker/containers/database/development.env
35
36
 
@@ -37,10 +38,11 @@ services:
37
38
  - database-data:/var/lib/postgresql/data
38
39
 
39
40
  web:
41
+ depends_on:
42
+ - app
40
43
  build:
41
44
  context: .
42
45
  dockerfile: docker/containers/web/Dockerfile
43
-
44
46
  volumes:
45
47
  database-data:
46
48
  gem_cache:
@@ -1,3 +1,3 @@
1
1
  module Roro
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - schadenfred
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-16 00:00:00.000000000 Z
11
+ date: 2019-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor