You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This project generates a PDF calendar with tide information for a specified tide station, year, and month. It includes a web interface built with Flask, and the application can be containerized using Docker.
app/routes.py: Contains the route for the web interface.
app/templates/index.html: HTML template for the web interface.
app/static/style.css: CSS file for styling the web interface.
get_tides.py: Script to generate the PDF calendar with tide information.
run.py: Entry point to run the Flask app.
requirements.txt: List of Python dependencies.
Dockerfile: Instructions to build the Docker image.
Usage
Enter the tide station ID, year, and month in the web form.
Click "Generate PDF" to create and download the tide calendar.
Notes
Ensurepcal andghostscript are installed on your system if running locally.
The default tide station ID is set to9449639 for demonstration purposes.
For deployment, it's common practice to use standard HTTP (port 80) or HTTPS (port 443) ports to make the application accessible over the web without specifying a port number in the URL. Here’s how you can set this up in your Docker deployment.
Using Port 80 or 443
Modify the Docker Run Command
To use port 80 or 443, map the internal port 5000 to the desired external port.
For HTTP (port 80):
docker run -p 80:5000 tide-calendar-app
For HTTPS (port 443):
docker run -p 443:5000 tide-calendar-app
Using HTTPS (port 443)
If you are using HTTPS, you'll need to set up SSL/TLS certificates. This is typically done using a reverse proxy like Nginx or a cloud provider's load balancer that handles SSL termination.
Example with Nginx as a Reverse Proxy
Nginx Configuration
Create an Nginx configuration file to proxy requests to your Flask app running inside Docker.
nginx.conf:
server {listen80;server_name yourdomain.com;location/{proxy_pass http://localhost:5000;proxy_set_header Host$host;proxy_set_header X-Real-IP$remote_addr;proxy_set_header X-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto$scheme; }}
Docker Compose
You can use Docker Compose to run both your Flask app and Nginx.
If you are using port 443, you’ll need to set up SSL certificates. Let’s Encrypt is a popular free option. Here’s a basic setup using Certbot with Nginx.
Install Certbot
Install Certbot and the Nginx plugin on your server.