chore: certbot script to bun

This commit is contained in:
Akshay Nair
2024-01-07 15:39:24 +05:30
parent c74f9195ac
commit 07015bb1eb
3 changed files with 10 additions and 9 deletions
+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 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"]
+1 -1
View File
@@ -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"
]
}
}
+4 -4
View File
@@ -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 "<key>"
# 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