Complete guide for deploying DiceTales to various hosting platforms and environments.
Platform | Difficulty | Cost | Best For |
---|---|---|---|
GitHub Pages | Easy | Free | Open source projects |
Netlify | Easy | Free | Quick prototypes |
Vercel | Easy | Free | Modern deployments |
Firebase Hosting | Medium | Free | Google ecosystem |
Self-Hosted | Hard | Variable | Full control |
Ensure these files are present in your repository:
index.html
- Main game interfaceadvanced/
directory with game filesbetter-dm/
directory for campaign managementbase/
directory for simple game versiondocs/
directory (optional but recommended)README.md
- Project description.gitignore
- Git ignore patternsadvanced/js/config.js
has correct settings for productionBest for: Open source projects, free hosting, automatic updates
git add .
git commit -m "Prepare for deployment"
git push origin main
https://yourusername.github.io/DiceTales/
echo "yourdomain.com" > CNAME
git add CNAME
git commit -m "Add custom domain"
git push
www
→ yourusername.github.io
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
# .github/workflows/pages.yml (optional - for advanced builds)
name: Deploy to GitHub Pages
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: '.'
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v1
Best for: Drag-and-drop deployment, build optimization, form handling
https://amazing-name-123456.netlify.app
)Build command: # Leave empty (static site)
Publish directory: . # Root directory
Create netlify.toml
in root directory:
[build]
publish = "."
command = ""
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Referrer-Policy = "strict-origin-when-cross-origin"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
condition = "Role=landing"
[context.production.environment]
NODE_ENV = "production"
www
→ your-site-name.netlify.app
Best for: Modern deployment, excellent performance, edge functions
npm i -g vercel
cd DiceTales
vercel
{
"version": 2,
"builds": [
{
"src": "**/*",
"use": "@vercel/static"
}
]
}
Create vercel.json
in root directory:
{
"version": 2,
"builds": [
{
"src": "**/*",
"use": "@vercel/static"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/$1"
}
],
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
}
]
}
]
}
Best for: Google ecosystem integration, analytics, performance monitoring
npm install -g firebase-tools
cd DiceTales
firebase login
firebase init hosting
// firebase.json
{
"hosting": {
"public": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
firebase deploy
Best for: Full control, custom server configuration, enterprise deployments
scp -r DiceTales/* user@server:/var/www/html/dicetales/
# /etc/apache2/sites-available/dicetales.conf
<VirtualHost *:80>
ServerName dicetales.yourdomain.com
DocumentRoot /var/www/html/dicetales
<Directory /var/www/html/dicetales>
AllowOverride All
Require all granted
</Directory>
# Security headers
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
Header always set X-XSS-Protection "1; mode=block"
</VirtualHost>
sudo a2ensite dicetales
sudo systemctl reload apache2
rsync -av DiceTales/ user@server:/var/www/dicetales/
# /etc/nginx/sites-available/dicetales
server {
listen 80;
server_name dicetales.yourdomain.com;
root /var/www/dicetales;
index index.html;
location / {
try_files $uri $uri/ =404;
}
# Security headers
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
# Cache static assets
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
sudo ln -s /etc/nginx/sites-available/dicetales /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
FROM nginx:alpine
COPY . /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
docker build -t dicetales .
docker run -d -p 8080:80 dicetales
# docker-compose.yml
version: '3.8'
services:
dicetales:
build: .
ports:
- "8080:80"
restart: unless-stopped
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d dicetales.yourdomain.com
sudo crontab -e
# Add: 0 12 * * * /usr/bin/certbot renew --quiet
<!-- Add to index.html head -->
<link rel="preconnect" href="https://api-inference.huggingface.co">
<link rel="preload" href="advanced/css/main.css" as="style">
<link rel="preload" href="advanced/js/main.js" as="script">
# Apache .htaccess
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
# Nginx configuration
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
location ~* \.(html)$ {
expires 1h;
add_header Cache-Control "public, must-revalidate";
}
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');
</script>
// Add to main.js
window.addEventListener('error', (event) => {
console.error('Global error:', event.error);
// Send to error tracking service
if (typeof gtag !== 'undefined') {
gtag('event', 'exception', {
description: event.error.message,
fatal: false
});
}
});
// Track AI response times
const trackAIPerformance = (service, duration, success) => {
if (typeof gtag !== 'undefined') {
gtag('event', 'ai_response_time', {
service: service,
duration: Math.round(duration),
success: success
});
}
};
“AI not working after deployment”
“Game won’t load”
“Styles not loading”
“Save/load not working”
Enable debug mode for troubleshooting:
// In advanced/js/config.js
const AI_CONFIG = {
DEBUG_MODE: true, // Enable debug logging
SHOW_AI_PROMPTS: true, // Log AI requests
LOG_PERFORMANCE: true // Track performance metrics
};
Create health.html
for monitoring:
<!DOCTYPE html>
<html>
<head>
<title>DiceTales Health Check</title>
</head>
<body>
<h1>DiceTales Status: OK</h1>
<p>Timestamp: <span id="timestamp"></span></p>
<script>
document.getElementById('timestamp').textContent = new Date().toISOString();
</script>
</body>
</html>
After successful deployment:
Need help? Check the Technical Overview for architectural details or Setup Guide for local development.