Skip to content

Commit

Permalink
Update bootstrap-post-dns.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdrgn2k authored Mar 28, 2019
1 parent dccc050 commit 6315f8e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions terraform/ipfs-server/bootstrap-post-dns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

# Get letsencrypt certificates with certbot
systemctl stop nginx.service
certbot certonly -n --agree-tos --standalone --email "${EMAIL_ADDRESS}" -d "${DOMAIN_NAME}" -d "ipfs-server.${DOMAIN_NAME}" -d "ipfs-gateway.${DOMAIN_NAME}"
certbot certonly -n --agree-tos --standalone --email "${EMAIL_ADDRESS}" -d "${DOMAIN_NAME}" -d "rtmp-server.${DOMAIN_NAME}" # -d "ipfs-gateway.${DOMAIN_NAME}"

# Configure nginx with HTTPS
cp -f /tmp/ipfs-server/nginx-default /etc/nginx/sites-available/default
sed -i "s#__DOMAIN_NAME__#${DOMAIN_NAME}#g" /etc/nginx/sites-available/default
cp -f /tmp/rtmp-server/nginx-default /usr/local/nginx/conf/conf.d/default
sed -i "s#__DOMAIN_NAME__#${DOMAIN_NAME}#g" /usr/local/nginx/conf/conf.d/default

cp -f /tmp/ipfs-server/nginx-gateway "/etc/nginx/sites-available/ipfs-gateway.${DOMAIN_NAME}"
sed -i "s#__DOMAIN_NAME__#${DOMAIN_NAME}#g" "/etc/nginx/sites-available/ipfs-gateway.${DOMAIN_NAME}"
ln -s "/etc/nginx/sites-available/ipfs-gateway.${DOMAIN_NAME}" "/etc/nginx/sites-enabled/ipfs-gateway.${DOMAIN_NAME}"

systemctl start nginx.service
cp -f /tmp/rtmp-server/nginx-gateway "/usr/local/nginx/conf/conf.d/ipfs-gateway.${DOMAIN_NAME}"
sed -i "s#__DOMAIN_NAME__#${DOMAIN_NAME}#g" "/usr/local/nginx/conf/conf.d/ipfs-gateway.${DOMAIN_NAME}"

# Configure auto-renewals
echo "30 2 * * 1 certbot renew >> /var/log/letsencrypt/letsencrypt.log" >> /etc/crontab
echo "35 2 * * 1 systemctl reload nginx" >> /etc/crontab
echo "35 2 * * 1 systemctl reload nginx" >> /etc/crontab

0 comments on commit 6315f8e

Please sign in to comment.