From 07015bb1eb8a2354d07ebe496fb683d2c70cbb69 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 7 Jan 2024 15:39:24 +0530 Subject: [PATCH] chore: certbot script to bun --- Dockerfile | 9 +++++---- domains/stefdp.json | 2 +- scripts/certbot.sh | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index d5a4de6b7..990a6e0b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,17 +5,18 @@ RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime RUN apt-get -y update RUN apt-get install -y nodejs npm curl wget dnsutils certbot --fix-missing +RUN apt-get install -y unzip -RUN npm i -g n yarn && n 15.11 +RUN bash -c "curl -fsSL https://bun.sh/install | bash -s 'bun-v1.0.15'" -RUN node -v +RUN ~/.bun/bin/bun -v WORKDIR /opt/app -COPY yarn.lock . +COPY bun.lockb . COPY package.json . -RUN yarn install +RUN ~/.bun/bin/bun install CMD ["sh", "-c", "cp -r node_modules code; cd code; tail -f /dev/null"] diff --git a/domains/stefdp.json b/domains/stefdp.json index 56c2fc2fd..2882eface 100644 --- a/domains/stefdp.json +++ b/domains/stefdp.json @@ -12,7 +12,7 @@ "mail.is-a.dev" ], "TXT": [ - " v=spf1 mx a:mail.is-a.dev ip4:217.174.245.249 ~all" + "v=spf1 mx a:mail.is-a.dev ip4:217.174.245.249 ~all" ] } } diff --git a/scripts/certbot.sh b/scripts/certbot.sh index 2ab0447ae..ee84aa6d7 100755 --- a/scripts/certbot.sh +++ b/scripts/certbot.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -export ENV=production +export NODE_ENV=production DRY_RUN=0 if_dry_run() { [[ $DRY_RUN == 1 ]] && echo "$1" || echo "$2"; } @@ -32,7 +32,7 @@ update_record() { local name="$3"; local address="$4"; local ttl=${5:-"1"}; - echo " + bun -e " const { domainService } = require('./utils/domain-service'); const { ENV, DOMAIN_DOMAIN } = require('./utils/constants'); const method = '$method'; @@ -57,7 +57,7 @@ update_record() { } main().catch(console.error); - " | node - + " } update_acme_txt_record() { @@ -68,6 +68,7 @@ reset_acme() { sleep 1; update_record remove TXT '_acme-challenge' ''; update_record remove TXT '_acme-challenge' ''; + # update_record add CNAME 'www' "is-a-dev.github.io"; } get_acme() { dig +noall +answer _acme-challenge.is-a.dev TXT | awk '{print $5}'; } @@ -84,7 +85,6 @@ esac ### STEPS ### # Run ./scripts/certbot.sh cert -# Run ./scripts/certbot.sh acme_txt "" # cp -r /tmp/is-a-dev-whatever /opt/app/code/is-a-dev-cert # Upload cert.pem and privkey.pem (from config/live/is-a.dev/) contents to SSL > Manage SSL Sites # Run ./scripts/certbot.sh reset