-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a HTTPS proxy for concourse on GCP (#62)
* Add a HTTPS proxy for concourse on GCP using a VIP and self signed certificate * Add letsencrypt support when concourse exposed on public IP * Force to use HTTPS * Update the documentation * Create a specific deployment for ingress * Fine tuning and hotfixes
- Loading branch information
Showing
13 changed files
with
235 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
pushd terraform | ||
BASTION_IP="$(terraform output bastion_ip)" | ||
popd | ||
|
||
ssh -D 5000 -fNC kite@$BASTION_IP -i <%= @values['kite']['private_key_path'] %> | ||
|
||
export BOSH_ALL_PROXY=socks5://localhost:5000 | ||
if [[ -z "${BASTION_IP}" ]]; then | ||
echo "Something goes wrong, please check terraform environement" 1>&2 | ||
false | ||
else | ||
ssh -D 5000 -fNC kite@${BASTION_IP} -i ~/.ssh/kite.key | ||
export BOSH_ALL_PROXY=socks5://localhost:5000 | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -xe | ||
|
||
bosh -e <%= @values['bosh']['name'] %> upload-release https://github.com/cloudfoundry-community/nginx-release/releases/download/v1.12.1/nginx-1.12.1.tgz | ||
|
||
bosh -e <%= @values['bosh']['name'] %> -d ingress deploy deployments/ingress/ingress.yml |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
--- | ||
name: ingress | ||
|
||
releases: | ||
- name: nginx | ||
version: latest | ||
|
||
instance_groups: | ||
- name: ingress | ||
instances: 1 | ||
vm_type: ingress-tiny | ||
azs: [z1] | ||
stemcell: trusty | ||
networks: | ||
- name: public | ||
static_ips: [<%= @private_subnet[13] %>] | ||
default: [dns, gateway] | ||
|
||
- name: vip | ||
static_ips: [<%= @values['ingress']['vip'] %>] | ||
|
||
jobs: | ||
- name: nginx | ||
release: nginx | ||
properties: | ||
nginx_conf: | | ||
worker_processes 1; | ||
error_log /var/vcap/sys/log/nginx/error.log info; | ||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include /var/vcap/packages/nginx/conf/mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
keepalive_timeout 65; | ||
server_names_hash_bucket_size 64; | ||
|
||
server { | ||
listen 80; | ||
return 301 https://$host$request_uri; | ||
} | ||
<% ingress_db.each do |hostname, config| %> | ||
<% upstream_name = hostname.gsub('.', '-') %> | ||
upstream <%= upstream_name %> { | ||
<%- config[:upstreams].each do |upstream| -%> | ||
server <%= upstream %>:<%= config[:port] %>; | ||
<%- end -%> | ||
} | ||
server { | ||
listen 443; | ||
server_name <%= hostname %>; | ||
ssl_certificate_key /var/vcap/jobs/nginx/etc/<%= hostname %>/key.pem; | ||
ssl_certificate /var/vcap/jobs/nginx/etc/<%= hostname %>/cert.pem; | ||
ssl on; | ||
ssl_session_cache builtin:1000 shared:SSL:10m; | ||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | ||
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; | ||
ssl_prefer_server_ciphers on; | ||
|
||
access_log /var/vcap/sys/log/nginx/<%= hostname %>-access.log; | ||
error_log /var/vcap/sys/log/nginx/<%= hostname %>-error.log; | ||
|
||
location / { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
|
||
proxy_pass <%= config[:protocol] %>://<%= upstream_name%>; | ||
proxy_read_timeout 90; | ||
} | ||
} | ||
<% end %> | ||
} | ||
|
||
pre_start: | | ||
#!/bin/bash | ||
set -x | ||
source /etc/profile | ||
export HOME=/root | ||
export USER=root | ||
echo "Running pre_start script as ${USER} with ${SHELL} with home ${HOME}" | ||
if [[ ! -f ${HOME}/.acme.sh/acme.sh.env ]]; then | ||
curl -s https://get.acme.sh | sh | ||
fi | ||
source ${HOME}/.acme.sh/acme.sh.env | ||
<% ingress_db.each do |hostname, config| -%> | ||
mkdir -p /var/vcap/jobs/nginx/etc/<%= hostname %>/ | ||
${HOME}/.acme.sh/acme.sh --issue --tls -d <%= hostname %> | ||
${HOME}/.acme.sh/acme.sh --install-cert -d <%= hostname %> \ | ||
--key-file /var/vcap/jobs/nginx/etc/<%= hostname %>/key.pem \ | ||
--fullchain-file /var/vcap/jobs/nginx/etc/<%= hostname %>/cert.pem | ||
<%- end -%> | ||
|
||
stemcells: | ||
- alias: trusty | ||
os: ubuntu-trusty | ||
version: latest | ||
|
||
update: | ||
canaries: 1 | ||
max_in_flight: 1 | ||
serial: false | ||
canary_watch_time: 1000-60000 | ||
update_watch_time: 1000-60000 |
Oops, something went wrong.