chore: certbot script to bun

This commit is contained in:
Akshay Nair committed 2024-01-07 15:39:24 +05:30
1 parent c74f9195ac
commit 07015bb1eb
3 files changed
+10 -9

No files matched your search

+5 -4
View File
@@ -5,17 +5,18 @@ RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update RUN apt-get -y update
RUN apt-get install -y nodejs npm curl wget dnsutils certbot --fix-missing 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 WORKDIR /opt/app
COPY yarn.lock . COPY bun.lockb .
COPY package.json . 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"] CMD ["sh", "-c", "cp -r node_modules code; cd code; tail -f /dev/null"]
+1 -1
View File
@@ -12,7 +12,7 @@
"mail.is-a.dev" "mail.is-a.dev"
], ],
"TXT": [ "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"
] ]
} }
} }
+4 -4
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export ENV=production export NODE_ENV=production
DRY_RUN=0 DRY_RUN=0
if_dry_run() { [[ $DRY_RUN == 1 ]] && echo "$1" || echo "$2"; } if_dry_run() { [[ $DRY_RUN == 1 ]] && echo "$1" || echo "$2"; }
@@ -32,7 +32,7 @@ update_record() {
local name="$3"; local name="$3";
local address="$4"; local address="$4";
local ttl=${5:-"1"}; local ttl=${5:-"1"};
echo " bun -e "
const { domainService } = require('./utils/domain-service'); const { domainService } = require('./utils/domain-service');
const { ENV, DOMAIN_DOMAIN } = require('./utils/constants'); const { ENV, DOMAIN_DOMAIN } = require('./utils/constants');
const method = '$method'; const method = '$method';
@@ -57,7 +57,7 @@ update_record() {
} }
main().catch(console.error); main().catch(console.error);
" | node - "
} }
update_acme_txt_record() { update_acme_txt_record() {
@@ -68,6 +68,7 @@ reset_acme() {
sleep 1; sleep 1;
update_record remove TXT '_acme-challenge' ''; update_record remove TXT '_acme-challenge' '';
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}'; } get_acme() { dig +noall +answer _acme-challenge.is-a.dev TXT | awk '{print $5}'; }
@@ -84,7 +85,6 @@ esac
### STEPS ### ### STEPS ###
# Run ./scripts/certbot.sh cert # Run ./scripts/certbot.sh cert
# Run ./scripts/certbot.sh acme_txt "<key>"
# cp -r /tmp/is-a-dev-whatever /opt/app/code/is-a-dev-cert # 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 # Upload cert.pem and privkey.pem (from config/live/is-a.dev/) contents to SSL > Manage SSL Sites
# Run ./scripts/certbot.sh reset # Run ./scripts/certbot.sh reset