-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
297 additions
and
229 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: setup-echo-server | ||
decription: | | ||
This action sets up an echo server associating a name to it. | ||
The name, e.g. `httpbin.org`, will be resolved to 127.0.0.1 by dnsmasq. | ||
inputs: | ||
upstream_dns_server: | ||
description: 'DNS server used by dnsmasq to resolve entries not yet cached' | ||
required: false | ||
default: '1.1.1.1' | ||
echo_server_name: | ||
description: 'A name dnsmasq will resolve to 127.0.0.1, e.g.: httpbin.org' | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- run: sudo apt-get install -y dnsmasq | ||
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-22.04' }} | ||
shell: bash | ||
- run: brew install dnsmasq | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
shell: bash | ||
|
||
- run: | | ||
sudo systemctl stop systemd-resolved | ||
sudo dnsmasq --no-hosts \ | ||
--no-resolv \ | ||
--server=${{ inputs.upstream_dns_server }} \ | ||
--address=/${{ inputs.echo_server_name }}/127.0.0.1 | ||
shell: bash | ||
- run: | | ||
cat <<EOT >> /tmp/nginx.conf | ||
server { | ||
listen 80; | ||
server_name '${{ inputs.echo_server_name }}'; | ||
listen 443 ssl; | ||
server_name '${{ inputs.echo_server_name }}'; | ||
ssl_protocols TLSv1.2; | ||
ssl_certificate /etc/nginx/hostname_cert.pem; | ||
ssl_certificate_key /etc/nginx/hostname_key.pem; | ||
location / { | ||
proxy_pass http://httpbin; | ||
} | ||
} | ||
EOT | ||
docker run --name httpbin -d kennethreitz/httpbin | ||
docker run --name httpbin_proxy \ | ||
--link httpbin \ | ||
-p 80:80 \ | ||
-p 443:443 \ | ||
-v /tmp/nginx.conf:/etc/nginx/nginx.conf.d/httpbin.conf:ro \ | ||
-v ./t/data/hostname_cert.pem:/etc/nginx/hostname_cert.pem:ro \ | ||
-v ./t/data/hostname_key.pem:/etc/nginx/hostname_key.pem:ro \ | ||
-d nginx | ||
shell: bash |
Oops, something went wrong.