puffinOffsetCalculator/setup.sh

63 lines
2.1 KiB
Bash

#!/bin/bash
# Puffin Offset Calculator Docker Setup Script
# This script sets up the Docker environment for the Puffin Offset Calculator
echo "========================================"
echo "Puffin Offset Calculator Docker Setup"
echo "========================================"
# Create logs directory if it doesn't exist
if [ ! -d "logs" ]; then
echo "Creating logs directory..."
mkdir -p logs
fi
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "Error: Docker is not installed. Please install Docker first."
exit 1
fi
# Check if Docker Compose is installed
if ! command -v docker-compose &> /dev/null; then
echo "Error: Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
echo "Logging into Gitea container registry..."
echo "Please enter your Gitea credentials when prompted:"
docker login code.letsbe.solutions
if [ $? -ne 0 ]; then
echo "========================================"
echo "Error: Failed to log in to the Gitea registry."
echo "Please check your credentials and try again."
echo "========================================"
exit 1
fi
echo "Pulling and starting the Docker container..."
docker-compose up -d
if [ $? -eq 0 ]; then
echo "========================================"
echo "Setup completed successfully!"
echo "Your calculator is now available at: http://localhost:8080"
echo ""
echo "Next steps for WordPress integration:"
echo "1. Copy wordpress-integration.php to your WordPress plugins directory"
echo "2. Create the required CSS and JS directories as described in README.docker.md"
echo "3. Activate the plugin in your WordPress admin panel"
echo "4. Use the [puffin_calculator] shortcode on any page or post"
echo ""
echo "For more details, please read the README.docker.md file."
echo "========================================"
else
echo "========================================"
echo "Error: Failed to start the Docker container."
echo "Please check the error messages above and try again."
echo "========================================"
exit 1
fi