Skip to content

Commit 8c16b34

Browse files
committed
Upgrade, fixes, caddy SSL + Basic Auth in pullpreview mode
1 parent 84b045b commit 8c16b34

File tree

15 files changed

+133
-327
lines changed

15 files changed

+133
-327
lines changed

.github/workflows/pullpreview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
admins: crohr
2424
always_on: master
25-
compose_files: "docker-compose.yml,docker-compose.staging.yml"
25+
compose_files: "docker-compose.yml,docker-compose.pullpreview.yml"
2626
default_port: 443
2727
instance_type: "micro_2_0"
2828
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
/log/*
1616
!/log/.keep
1717
/tmp
18+
/node_modules

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Use the barebones version of Ruby 2.2.3.
22
FROM ruby:2.7-slim
33

4-
MAINTAINER Cyril Rohr <cyril@pullpreview.com>
4+
MAINTAINER Cyril Rohr <support@pullpreview.com>
55

66
# Install dependencies:
77
RUN apt-get update && apt-get install -qq -y build-essential nodejs libpq-dev postgresql-client
@@ -30,3 +30,5 @@ RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@12
3030

3131
# The default command that gets ran will be to start the Unicorn server.
3232
CMD ./docker/web
33+
34+
EXPOSE 3000

Gemfile.lock

Lines changed: 85 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,155 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (5.2.4.2)
5-
actionpack (= 5.2.4.2)
4+
actioncable (5.2.6.2)
5+
actionpack (= 5.2.6.2)
66
nio4r (~> 2.0)
77
websocket-driver (>= 0.6.1)
8-
actionmailer (5.2.4.2)
9-
actionpack (= 5.2.4.2)
10-
actionview (= 5.2.4.2)
11-
activejob (= 5.2.4.2)
8+
actionmailer (5.2.6.2)
9+
actionpack (= 5.2.6.2)
10+
actionview (= 5.2.6.2)
11+
activejob (= 5.2.6.2)
1212
mail (~> 2.5, >= 2.5.4)
1313
rails-dom-testing (~> 2.0)
14-
actionpack (5.2.4.2)
15-
actionview (= 5.2.4.2)
16-
activesupport (= 5.2.4.2)
14+
actionpack (5.2.6.2)
15+
actionview (= 5.2.6.2)
16+
activesupport (= 5.2.6.2)
1717
rack (~> 2.0, >= 2.0.8)
1818
rack-test (>= 0.6.3)
1919
rails-dom-testing (~> 2.0)
2020
rails-html-sanitizer (~> 1.0, >= 1.0.2)
21-
actionview (5.2.4.2)
22-
activesupport (= 5.2.4.2)
21+
actionview (5.2.6.2)
22+
activesupport (= 5.2.6.2)
2323
builder (~> 3.1)
2424
erubi (~> 1.4)
2525
rails-dom-testing (~> 2.0)
2626
rails-html-sanitizer (~> 1.0, >= 1.0.3)
27-
activejob (5.2.4.2)
28-
activesupport (= 5.2.4.2)
27+
activejob (5.2.6.2)
28+
activesupport (= 5.2.6.2)
2929
globalid (>= 0.3.6)
30-
activemodel (5.2.4.2)
31-
activesupport (= 5.2.4.2)
32-
activerecord (5.2.4.2)
33-
activemodel (= 5.2.4.2)
34-
activesupport (= 5.2.4.2)
30+
activemodel (5.2.6.2)
31+
activesupport (= 5.2.6.2)
32+
activerecord (5.2.6.2)
33+
activemodel (= 5.2.6.2)
34+
activesupport (= 5.2.6.2)
3535
arel (>= 9.0)
36-
activestorage (5.2.4.2)
37-
actionpack (= 5.2.4.2)
38-
activerecord (= 5.2.4.2)
39-
marcel (~> 0.3.1)
40-
activesupport (5.2.4.2)
36+
activestorage (5.2.6.2)
37+
actionpack (= 5.2.6.2)
38+
activerecord (= 5.2.6.2)
39+
marcel (~> 1.0.0)
40+
activesupport (5.2.6.2)
4141
concurrent-ruby (~> 1.0, >= 1.0.2)
4242
i18n (>= 0.7, < 2)
4343
minitest (~> 5.1)
4444
tzinfo (~> 1.1)
4545
arel (9.0.0)
46-
binding_of_caller (0.7.2)
46+
binding_of_caller (1.0.0)
4747
debug_inspector (>= 0.0.1)
4848
builder (3.2.4)
49-
concurrent-ruby (1.1.6)
50-
connection_pool (2.2.0)
49+
concurrent-ruby (1.1.9)
50+
connection_pool (2.2.5)
5151
crass (1.0.6)
52-
debug_inspector (0.0.2)
53-
erubi (1.9.0)
54-
execjs (2.7.0)
55-
globalid (0.4.2)
56-
activesupport (>= 4.2.0)
57-
i18n (1.8.2)
52+
debug_inspector (1.1.0)
53+
erubi (1.10.0)
54+
execjs (2.8.1)
55+
globalid (1.0.0)
56+
activesupport (>= 5.0)
57+
i18n (1.10.0)
5858
concurrent-ruby (~> 1.0)
59-
jquery-rails (4.2.1)
59+
jquery-rails (4.4.0)
6060
rails-dom-testing (>= 1, < 3)
6161
railties (>= 4.2.0)
6262
thor (>= 0.14, < 2.0)
63-
loofah (2.5.0)
63+
loofah (2.14.0)
6464
crass (~> 1.0.2)
6565
nokogiri (>= 1.5.9)
6666
mail (2.7.1)
6767
mini_mime (>= 0.1.1)
68-
marcel (0.3.3)
69-
mimemagic (~> 0.3.2)
68+
marcel (1.0.2)
7069
method_source (1.0.0)
71-
mimemagic (0.3.4)
72-
mini_mime (1.0.2)
73-
mini_portile2 (2.4.0)
74-
minitest (5.14.0)
75-
nio4r (2.5.2)
76-
nokogiri (1.10.9)
77-
mini_portile2 (~> 2.4.0)
78-
pg (0.18.4)
79-
puma (3.12.4)
80-
rack (2.2.2)
70+
mini_mime (1.1.2)
71+
mini_portile2 (2.7.1)
72+
minitest (5.15.0)
73+
nio4r (2.5.8)
74+
nokogiri (1.13.1)
75+
mini_portile2 (~> 2.7.0)
76+
racc (~> 1.4)
77+
pg (1.3.2)
78+
puma (5.6.2)
79+
nio4r (~> 2.0)
80+
racc (1.6.0)
81+
rack (2.2.3)
8182
rack-test (1.1.0)
8283
rack (>= 1.0, < 3)
83-
rails (5.2.4.2)
84-
actioncable (= 5.2.4.2)
85-
actionmailer (= 5.2.4.2)
86-
actionpack (= 5.2.4.2)
87-
actionview (= 5.2.4.2)
88-
activejob (= 5.2.4.2)
89-
activemodel (= 5.2.4.2)
90-
activerecord (= 5.2.4.2)
91-
activestorage (= 5.2.4.2)
92-
activesupport (= 5.2.4.2)
84+
rails (5.2.6.2)
85+
actioncable (= 5.2.6.2)
86+
actionmailer (= 5.2.6.2)
87+
actionpack (= 5.2.6.2)
88+
actionview (= 5.2.6.2)
89+
activejob (= 5.2.6.2)
90+
activemodel (= 5.2.6.2)
91+
activerecord (= 5.2.6.2)
92+
activestorage (= 5.2.6.2)
93+
activesupport (= 5.2.6.2)
9394
bundler (>= 1.3.0)
94-
railties (= 5.2.4.2)
95+
railties (= 5.2.6.2)
9596
sprockets-rails (>= 2.0.0)
9697
rails-dom-testing (2.0.3)
9798
activesupport (>= 4.2.0)
9899
nokogiri (>= 1.6)
99-
rails-html-sanitizer (1.3.0)
100+
rails-html-sanitizer (1.4.2)
100101
loofah (~> 2.3)
101-
railties (5.2.4.2)
102-
actionpack (= 5.2.4.2)
103-
activesupport (= 5.2.4.2)
102+
railties (5.2.6.2)
103+
actionpack (= 5.2.6.2)
104+
activesupport (= 5.2.6.2)
104105
method_source
105106
rake (>= 0.8.7)
106107
thor (>= 0.19.0, < 2.0)
107-
rake (13.0.1)
108+
rake (13.0.6)
108109
record_tag_helper (1.0.1)
109110
actionview (>= 5)
110-
redis (3.3.1)
111-
redis-actionpack (5.2.0)
112-
actionpack (>= 5, < 7)
111+
redis (4.6.0)
112+
redis-actionpack (5.3.0)
113+
actionpack (>= 5, < 8)
113114
redis-rack (>= 2.1.0, < 3)
114115
redis-store (>= 1.1.0, < 2)
115-
redis-activesupport (5.2.0)
116-
activesupport (>= 3, < 7)
116+
redis-activesupport (5.3.0)
117+
activesupport (>= 3, < 8)
117118
redis-store (>= 1.3, < 2)
118-
redis-rack (2.1.2)
119+
redis-rack (2.1.4)
119120
rack (>= 2.0.8, < 3)
120121
redis-store (>= 1.2, < 2)
121122
redis-rails (5.0.2)
122123
redis-actionpack (>= 5.0, < 6)
123124
redis-activesupport (>= 5.0, < 6)
124125
redis-store (>= 1.2, < 2)
125-
redis-store (1.6.0)
126-
redis (>= 2.2, < 5)
127-
sidekiq (4.0.2)
128-
concurrent-ruby (~> 1.0)
129-
connection_pool (~> 2.2, >= 2.2.0)
130-
redis (~> 3.2, >= 3.2.1)
131-
sprockets (3.7.2)
126+
redis-store (1.9.1)
127+
redis (>= 4, < 5)
128+
sidekiq (6.4.1)
129+
connection_pool (>= 2.2.2)
130+
rack (~> 2.0)
131+
redis (>= 4.2.0)
132+
sprockets (4.0.2)
132133
concurrent-ruby (~> 1.0)
133134
rack (> 1, < 3)
134-
sprockets-rails (3.2.1)
135-
actionpack (>= 4.0)
136-
activesupport (>= 4.0)
135+
sprockets-rails (3.4.2)
136+
actionpack (>= 5.2)
137+
activesupport (>= 5.2)
137138
sprockets (>= 3.0.0)
138-
thor (1.0.1)
139+
thor (1.2.1)
139140
thread_safe (0.3.6)
140-
tzinfo (1.2.7)
141+
tzinfo (1.2.9)
141142
thread_safe (~> 0.1)
142-
uglifier (3.0.2)
143+
uglifier (4.2.0)
143144
execjs (>= 0.3.0, < 3)
144145
web-console (2.3.0)
145146
activemodel (>= 4.0)
146147
binding_of_caller (>= 0.7.2)
147148
railties (>= 4.0)
148149
sprockets-rails (>= 2.0, < 4.0)
149-
websocket-driver (0.7.1)
150+
websocket-driver (0.7.5)
150151
websocket-extensions (>= 0.1.0)
151-
websocket-extensions (0.1.4)
152+
websocket-extensions (0.1.5)
152153

153154
PLATFORMS
154155
ruby
@@ -165,4 +166,4 @@ DEPENDENCIES
165166
web-console (~> 2.0)
166167

167168
BUNDLED WITH
168-
2.0.1
169+
2.2.22

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@
55
Have a look at the `.github/workflows/pullpreview.yml` file, as well as the `docker-compose.*` files to see how it's setup.
66

77
Deployments are visible on https://github.com/pullpreview/demo-ruby-on-rails/deployments.
8+
9+
In this demo, PullPreview is configured with Caddy as a proxy, which automatically provides SSL certificates, as well as protecting the access to the preview environment with a Basic Auth:
10+
11+
- username=`admin`
12+
- password=`p4ssw0rd`
13+
14+
## How to run locally for development
15+
16+
PULLPREVIEW_PUBLIC_DNS=perso.click docker-compose -f docker-compose.yml -f docker-compose.pullpreview.yml up

app/assets/config/manifest.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//= link_tree ../images
2+
//= link_directory ../javascripts .js
3+
//= link_directory ../stylesheets .css

config/unicorn.rb

Lines changed: 0 additions & 69 deletions
This file was deleted.

docker-compose.override.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
version: '3'
1+
version: "3"
22
services:
33
web:
44
ports:
5-
- '80:8000'
5+
- "80:3000"
66
env_file:
77
- .env.development
88
worker:

docker-compose.staging.yml renamed to docker-compose.pullpreview.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
version: '3'
1+
version: "3"
22
services:
33
web:
4-
ports:
5-
- "8000"
64
env_file:
75
- .env.staging
86
worker:
97
env_file:
108
- .env.staging
119
proxy:
1210
image: caddy:2-alpine
13-
command: "caddy reverse-proxy --from ${PULLPREVIEW_PUBLIC_DNS} --to web:8000"
11+
environment:
12+
- SITE_FQDN=${PULLPREVIEW_PUBLIC_DNS}
13+
- SITE_PASSWORD
14+
command: "/docker/caddy/run"
1415
restart: unless-stopped
16+
volumes:
17+
- "./docker/caddy:/docker/caddy"
1518
depends_on:
1619
- web
1720
networks:

0 commit comments

Comments
 (0)