Commit two

This commit is contained in:
admin 2025-05-12 00:42:26 -06:00
parent a00a62f928
commit e33ebdb0d1
9 changed files with 252 additions and 2 deletions

21
.dockerignore Normal file
View File

@ -0,0 +1,21 @@
# Version control
.git
.gitignore
# Docker files
Dockerfile
docker-compose.yml
.dockerignore
# Documentation
README.md
# Development files
node_modules
npm-debug.log
yarn-error.log
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
website/*
!website/.gitignore

88
CLOUDFLARE-SETUP.md Normal file
View File

@ -0,0 +1,88 @@
# Setting Up Cloudflare Tunnel for ABforAbortion Website
This guide will walk you through the process of setting up a Cloudflare Tunnel to securely expose your ABforAbortion website to the internet without opening ports on your firewall.
## Prerequisites
1. A Cloudflare account
2. A domain registered and using Cloudflare DNS
3. Docker and Docker Compose installed on your server
## Step 1: Install cloudflared CLI
```bash
# For Debian/Ubuntu
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared.deb
# For other systems, visit: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/
```
## Step 2: Authenticate with Cloudflare
```bash
cloudflared login
```
This command will open a browser window. Log in to your Cloudflare account and authorize the cloudflared application to access your account.
## Step 3: Create a Tunnel
```bash
cloudflared tunnel create abforabortion-tunnel
```
This will create a new tunnel and store the credentials in `~/.cloudflared/[TUNNEL-ID].json`.
## Step 4: Get Your Tunnel ID
```bash
cloudflared tunnel list
```
Note the tunnel ID - you'll need to update it in the `cloudflared-config.yml` file.
## Step 5: Set Up DNS Records
```bash
# Replace with your actual domain and tunnel ID
cloudflared tunnel route dns your-tunnel-id abforabortion.com
cloudflared tunnel route dns your-tunnel-id www.abforabortion.com
```
## Step 6: Update the Configuration File
Edit the `cloudflared-config.yml` file:
1. Replace `your-tunnel-id` with your actual tunnel ID
2. Update the hostnames to match your domain
## Step 7: Start the Docker Containers
```bash
docker-compose -f docker-compose-with-cloudflare.yml up -d
```
## Step 8: Monitor the Tunnel
```bash
# Check logs
docker-compose -f docker-compose-with-cloudflare.yml logs -f cloudflared
# Check status
cloudflared tunnel info your-tunnel-id
```
## Troubleshooting
- **Connection issues**: Check if the cloudflared container can access the web container
- **DNS issues**: Verify DNS records in your Cloudflare dashboard
- **Authentication issues**: Ensure credentials file exists and is mounted correctly
## Security Considerations
- The Cloudflare Tunnel provides secure access without exposing your server's IP address
- All traffic is encrypted between visitors and your origin server
- Authentication happens via Cloudflare's authentication system
For more information, visit the [Cloudflare Tunnel documentation](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/).

View File

@ -62,8 +62,10 @@ For detailed instructions, see the [official Webflow Code Export guide](https://
- Basic knowledge of terminal commands
### Steps to Deploy
1. Clone or copy this repository to your server
1. Clone this repository to your server:
```bash
git clone https://gitea.bnkhome.org/bnkops/webflow.quick.server.git
```
2. Extract your Webflow code export into the `website/` directory

28
cloudflared-config.yml Normal file
View File

@ -0,0 +1,28 @@
## Cloudflare Tunnel configuration file
## This config connects your local website to the internet securely using Cloudflare Tunnels
# Tunnel configuration
tunnel: your-tunnel-id # Replace with your actual tunnel ID from Cloudflare
credentials-file: /root/.cloudflared/your-tunnel-id.json # Path to your tunnel credentials file
# Ingress rules define how traffic is routed
ingress:
# First rule: route all traffic to your local website
- hostname: abforabortion.com # Replace with your domain
service: http://localhost:80
# Second rule: you can add additional hostnames/subdomains
- hostname: www.abforabortion.com # Replace with your subdomain
service: http://localhost:80
# Default catch-all rule (required)
- service: http_status:404
# Log level options: debug, info, warn, error, fatal
logfile: /var/log/cloudflared.log
loglevel: info
# Optional: Set to true in production
originRequest:
connectTimeout: 30s
noTLSVerify: false

28
deploy.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# Make the script executable with: chmod +x deploy.sh
echo "=== AB for Abortion Website Deployment ==="
echo "Directory structure:"
echo " - website/ - Contains all website files"
echo " - nginx.conf - Web server configuration"
echo " - docker-compose.yml - Docker configuration"
echo "========================================"
# Stop running containers
echo "Stopping any running containers..."
docker-compose down
# Pull the latest nginx image
echo "Pulling latest nginx:alpine image..."
docker-compose pull
# Start containers in detached mode
echo "Starting containers..."
docker-compose up -d
# Display container status
echo "Container status:"
docker-compose ps
echo "Deployment complete! The website should be accessible at http://localhost"

View File

@ -0,0 +1,31 @@
version: '3'
services:
# Your existing web server
web:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./website:/usr/share/nginx/html
- ./nginx.conf:/etc/nginx/conf.d/default.conf
restart: always
networks:
- web_network
# Cloudflare tunnel service
cloudflared:
image: cloudflare/cloudflared:latest
command: tunnel --config /etc/cloudflared/config.yml run
volumes:
- ./cloudflared-config.yml:/etc/cloudflared/config.yml:ro
- ~/.cloudflared:/root/.cloudflared:ro # Mount credentials from host
restart: always
depends_on:
- web
networks:
- web_network
networks:
web_network:
driver: bridge

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: '3'
services:
web:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./website:/usr/share/nginx/html
- ./nginx.conf:/etc/nginx/conf.d/default.conf
restart: always

38
nginx.conf Normal file
View File

@ -0,0 +1,38 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Enable gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
gzip_comp_level 6;
# Cache static assets
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|webp|avif|otf|ttf|woff|woff2)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
# Handle error pages
error_page 404 /404.html;
error_page 401 /401.html;
location = /404.html {
internal;
}
location = /401.html {
internal;
}
# Handle all HTML files and directories
location / {
try_files $uri $uri/ /index.html;
}
}