From 60ee082f13de59080dd263c76ba048b83483eb01 Mon Sep 17 00:00:00 2001 From: Arpit Bhayani Date: Tue, 10 Dec 2024 17:44:34 +0530 Subject: [PATCH] Setup script --- README.md | 8 +++++- setup.sh | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 setup.sh diff --git a/README.md b/README.md index 8ab9489..8a81bcb 100644 --- a/README.md +++ b/README.md @@ -70,4 +70,10 @@ Open your browser and go to: ```bash http://localhost:8080/health ``` -This endpoint should return a status indicating that the server is up and running. \ No newline at end of file +This endpoint should return a status indicating that the server is up and running. + +## Setting up Production Instance + +``` +bash setup.sh +``` diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..cbef7d3 --- /dev/null +++ b/setup.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +# Nginx and SSL Setup Script for dicedb.io +# Usage: sudo bash setup_nginx_ssl.sh + +# Check if script is run with sudo +if [[ $EUID -ne 0 ]]; then + echo "This script must be run with sudo or as root" + exit 1 +fi + +# Email for Let's Encrypt registration +LETSENCRYPT_EMAIL=arpit@dicedb.io + +# Update system packages +echo "Updating system packages..." +apt update && apt upgrade -y + +# Install required packages +echo "Installing Nginx and Certbot..." +apt install -y nginx certbot python3-certbot-nginx + +# Create Nginx configuration file +echo "Creating Nginx configuration..." +cat > /etc/nginx/sites-available/dicedb <