Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add proxy-setup.sh #42

Merged
merged 9 commits into from
Nov 22, 2024
Merged

feat: add proxy-setup.sh #42

merged 9 commits into from
Nov 22, 2024

Conversation

bap2pecs
Copy link
Member

@bap2pecs bap2pecs commented Nov 21, 2024

Summary

Snapchain/babylon-deployment#47

Test Plan

make l2-proxy-setup

then check success

$ echo $?
0

also see

image

verify the certs

sudo openssl x509 -in /etc/letsencrypt/live/tohma.snapchain.dev/fullchain.pem -text | grep DNS:
                DNS:bridge.tohma.snapchain.dev, DNS:explorer.tohma.snapchain.dev, DNS:rpc.tohma.snapchain.dev

now restart the explorer after setting .env.explorer with

COMMON_HOST=explorer.tohma.snapchain.dev
API_PROTOCOL=https # http | https
API_WEBSOCKET_PROTOCOL=wss # ws | wss

see https://explorer.tohma.snapchain.dev/ can load

also https://bridge.tohma.snapchain.dev/ loads

also rpc works cast chain-id --rpc-url https://rpc.tohma.snapchain.dev/

@bap2pecs bap2pecs requested a review from a team as a code owner November 21, 2024 22:57
@@ -79,7 +79,7 @@ services:
FRONT_PROXY_PASS: http://frontend:3000
STATS_PROXY_PASS: http://stats:8050/
ports:
- 80:80
- 8088:80
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed b/c otherwise sudo certbot certonly --nginx will fail with

telegram-cloud-photo-size-1-5044123014374993588-y

listen 443 ssl;
server_name explorer.${CERTBOT_DOMAIN_SUFFIX};

ssl_certificate /etc/letsencrypt/live/${CERTBOT_DOMAIN_SUFFIX}/fullchain.pem;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parketh jfyi, the cert won't be called bridge.tohma.snapchain.dev, explorer.tohma.snapchain.dev

now all certs are created under the same dir

# 2. obtain the SSL certificate for each subdomain
# the certs will be stored in /etc/letsencrypt/live/${CERTBOT_DOMAIN_SUFFIX}
# 
# note that Certbot creates a single certificate that's valid for all those 
# domains (called a SAN - Subject Alternative Names certificate)
# 
# after running the command, you can verify by:
#   sudo openssl x509 -in /etc/letsencrypt/live/${CERTBOT_DOMAIN_SUFFIX}/fullchain.pem -text | grep DNS:
# 
# reference: https://eff-certbot.readthedocs.io/en/latest/using.html
certbot certonly --nginx --non-interactive --agree-tos -m ${CERTBOT_EMAIL} \
  --cert-name ${CERTBOT_DOMAIN_SUFFIX} \
  -d rpc.${CERTBOT_DOMAIN_SUFFIX} \
  -d bridge.${CERTBOT_DOMAIN_SUFFIX} \
  -d explorer.${CERTBOT_DOMAIN_SUFFIX}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so do we generate one certificate for the domain, and reuse it across tohma-devnet and tohma-finality-system servers? or are these two different certificates for the same domain?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes there is only one file

sudo ls /etc/letsencrypt/live/tohma.snapchain.dev                                                                                 ─╯
README	cert.pem  chain.pem  fullchain.pem  privkey.pem

and you can run this command on the server to test

sudo openssl x509 -in /etc/letsencrypt/live/tohma.snapchain.dev/fullchain.pem -text | grep DNS:                                   ─╯
                DNS:bridge.tohma.snapchain.dev, DNS:explorer.tohma.snapchain.dev, DNS:rpc.tohma.snapchain.dev

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a single cert the valid for all domains

@bap2pecs bap2pecs changed the title feat: add dns-setup.sh feat: add proxy-setup.sh Nov 22, 2024
@bap2pecs bap2pecs merged commit 64826d6 into main Nov 22, 2024
1 check passed
@bap2pecs bap2pecs deleted the feat/dns-setup branch November 22, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants