rybbit/setup.sh
Bill Yang d10017686f
Add caddy (#90)
* Add Nginx and Certbot services to Docker Compose

- Introduced Nginx service with custom configuration for handling HTTP and HTTPS traffic, including volume mounts for templates and entrypoint script.
- Added Certbot service for automated SSL certificate management, with a renewal loop and environment variable support for domain and email.
- Updated existing services to include restart policies and removed unnecessary port mappings for backend and client services.
- Enhanced volume management by adding certbot-conf and certbot-www for certificate storage and challenge handling.

* remove volume

* Replace Nginx and Certbot with Caddy in Docker Compose

- Removed Nginx and Certbot services, streamlining the configuration for SSL management.
- Introduced Caddy service with automatic HTTPS support and simplified volume management.
- Updated environment variables for domain and email configuration, ensuring compatibility with Caddy's setup.
- Enhanced volume definitions for persistent data and configuration storage.

* Fix

* Fix

* Remove Nginx and Certbot configurations from Docker setup

- Deleted Nginx and Certbot Dockerfiles, entrypoint scripts, and associated configuration files to streamline the project.
- Updated docker-compose.yml to remove Certbot email configuration, reflecting the transition to Caddy for SSL management.

* Remove version declaration from docker-compose.yml to simplify configuration

* Refactor login page to simplify account creation prompt

- Removed conditional rendering for the sign-up link, ensuring it is always displayed for better user accessibility.

* Update self-hosting documentation for Frogstats

- Revamped the self-hosting guide to provide clearer instructions for setting up Frogstats.
- Added prerequisites section detailing requirements such as a Linux VPS, domain name, Docker, and Git.
- Enhanced setup steps with detailed commands for installing Docker and Git, cloning the repository, and running the setup script.
- Included a callout for compatibility with Ubuntu 24 LTS and emphasized the importance of HTTPS for tracking scripts.
2025-04-16 23:04:17 -07:00

48 lines
No EOL
1.3 KiB
Bash

#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# Check if domain name argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <domain_name>"
echo "Example: $0 myapp.example.com"
exit 1
fi
DOMAIN_NAME="$1"
BASE_URL="https://${DOMAIN_NAME}"
# Generate a secure random secret for BETTER_AUTH_SECRET
# Uses OpenSSL if available, otherwise falls back to /dev/urandom
if command -v openssl &> /dev/null; then
BETTER_AUTH_SECRET=$(openssl rand -hex 32)
elif [ -e /dev/urandom ]; then
BETTER_AUTH_SECRET=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)
else
echo "Error: Could not generate secure secret. Please install openssl or ensure /dev/urandom is available." >&2
exit 1
fi
# Create or overwrite the .env file
echo "Creating .env file..."
cat > .env << EOL
# Variables configured by setup.sh
DOMAIN_NAME=${DOMAIN_NAME}
BASE_URL=${BASE_URL}
BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
# Defaulting to empty strings to suppress docker-compose warnings
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
CLOUD=
EOL
echo ".env file created successfully with domain ${DOMAIN_NAME}."
# Build and start the Docker Compose stack
echo "Building and starting Docker services..."
docker compose up --build -d
echo "Setup complete. Services are starting in the background."
echo "You can monitor logs with: docker compose logs -f"