Skip to content

Commit

Permalink
Use openresty
Browse files Browse the repository at this point in the history
  • Loading branch information
dcadenas committed Nov 29, 2023
1 parent 97eb071 commit d756d6f
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
strfry/db/*
nginx/letsencrypt
openresty/letsencrypt

18 changes: 12 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
version: '3'

services:
nginx:
build: ./nginx
openresty:
image: openresty/openresty:1.21.4.3-1-jammy
ports:
- '80:80'
- '443:443'
volumes:
- ./nginx/nginx.default.conf:/etc/nginx/conf.d/default.conf
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./html:/var/www/html
- ./nginx/letsencrypt:/etc/letsencrypt
- ./openresty/nginx.default.conf:/etc/nginx/conf.d/default.conf
- ./html:/usr/local/openresty/nginx/html
- ./openresty/letsencrypt:/etc/letsencrypt
depends_on:
- strfry

Expand All @@ -20,3 +19,10 @@ services:
- ./strfry/config/strfry.conf:/etc/strfry.conf
- ./strfry/db:/app/strfry-db
- ./strfry/plugins:/app/plugins
certbot:
image: certbot/certbot
container_name: certbot
volumes:
- ./openresty/letsencrypt:/etc/letsencrypt
- ./html:/usr/local/openresty/nginx/html
command: certonly --webroot -w /usr/local/openresty/nginx/html --force-renewal --email [email protected] -d relay.nos.social --agree-tos
2 changes: 1 addition & 1 deletion html/relay_home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h1 class="display-1 text-center">nos relay</h1>
</p>
</div>
<div class="image-content">
<img src="/example.png" alt="Mobile App Screenshot">
<img src="/screenshot.png" alt="Mobile App Screenshot">
</div>
</div>
</div>
Expand Down
File renamed without changes
7 changes: 0 additions & 7 deletions nginx/Dockerfile

This file was deleted.

37 changes: 0 additions & 37 deletions nginx/nginx.conf

This file was deleted.

27 changes: 20 additions & 7 deletions nginx/nginx.default.conf → openresty/nginx.default.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
root /usr/local/openresty/nginx/html;

resolver 8.8.8.8;

# We redirect to stdout and stderr to get everything in docker logs
access_log /dev/stdout;
error_log /dev/stderr;

# use_proxy is a variable we use to determine whether or not to send the
# request to the nostr relay
map $http_upgrade$http_accept $use_proxy {
default 0;
~*websocket 1;
"~*application/nostr\+json" 1;
}

server {
server_name host.docker.internal;
root /var/www/html;

location / {
error_page 418 = /relay_home$uri;
Expand All @@ -21,7 +36,10 @@ server {
}

location /relay_home {
try_files $uri $uri/ /index.html =404;
#try_files $uri $uri/ /index.html =404;
proxy_ssl_server_name on;
proxy_set_header Host nos-relay.webflow.io;
proxy_pass https://nos-relay.webflow.io$request_uri;
}

# An example lud16 config that just redirects users to the alby wallet, this
Expand All @@ -45,11 +63,6 @@ server {
server_name relay.nos.social;
listen 80;

# This will be needed once we enable cert autorenewal
location ^~ /.well-known/acme-challenge {
root /var/www/certbot;
}

if ($host = relay.nos.social) {
return 301 https://$host$request_uri;
}
Expand Down

0 comments on commit d756d6f

Please sign in to comment.