Skip to content

Commit a50d676

Browse files
committed
defines a staging execution mode
1 parent 9321640 commit a50d676

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
/tmp
44
/rails.git
55
config/master.key
6+
public/assets
7+
public/cache

config/database.yml

+4
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ development:
1111
test:
1212
<<: *defaults
1313
database: rails_contributors_test
14+
15+
staging:
16+
<<: *defaults
17+
database: rails_contributors_development

config/environments/staging.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
production.rb

doc/docker.md

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ $ docker/rails runner 'p Commit.count'
6565
$ ...
6666
```
6767

68+
The command `docker/server staging` runs the application in `staging` mode. That is a production-like environment (`config/environments/staging.rb` is a symlink to `config/environments/production.rb`), but it uses the development database and serves static files. If there are changes that act differently in `development` and `production`, this execution mode may be useful for checking things up before deployment.
69+
6870
If you modify the name mappings, hard-coded authors, etc., `docker/sync`
6971
updates the credits and it does so changing as little as possible. The command also accepts an optional argument `all`, which forces the recomputation of all assignments. This is handy when you've changed the heuristics, and it takes less than a full database rebuild, since it does not reimport the commits themselves (which is costly).
7072

docker/server

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/bash
22

3-
if [[ $1 = 'production' ]]; then
4-
docker/rails assets:precompile
3+
if [[ $1 = 'staging' ]]; then
4+
docker-compose exec -e RAILS_ENV=staging app \
5+
bin/rails assets:precompile
56
docker-compose exec -e RAILS_SERVE_STATIC_FILES=1 app \
6-
bin/rails server -b 0.0.0.0 -e production
7+
bin/rails server -b 0.0.0.0 -e staging
78
else
89
docker/rails server -b 0.0.0.0
910
fi

0 commit comments

Comments
 (0)