# Hephaestus Deployment Task: TekDek Documentation Website

**Status**: Ready for assignment  
**Assigned to**: Hephaestus  
**Priority**: High  
**Timeline**: After Icarus CSS complete

---

## Objective

Deploy the complete TekDek documentation website to production:
1. Create `companyWebsite` repo in Gitea under TekDekOC organization
2. Push all website code to Gitea
3. Deploy to live web server (web.tekdek.dev)
4. Maintain Gitea copies as rollback fallback
5. Verify all systems operational

---

## Scope

### Website Content
- Complete PHP framework (16 files)
- CSS styling (3 files: base, components, responsive)
- Pages: Home, About, Projects, Tools, Team, Decisions, 404
- JavaScript (mobile menu)
- Assets folder

### Gitea Repository
- **Organization**: TekDekOC
- **Repository**: companyWebsite
- **Branch**: main
- **Access**: Team-wide read, Hephaestus write

### Web Server Deployment
- **Server**: web.tekdek.dev
- **Path**: /publish/web1/public/docs/ (new subdirectory)
- **URL**: https://web.tekdek.dev/docs/
- **Existing**: /team.html remains at https://web.tekdek.dev/team.html
- **New landing**: https://web.tekdek.dev/ links to /docs/

---

## Pre-Deployment Checklist

Before deployment, verify:

- [ ] All CSS files built by Icarus
- [ ] All PHP files generated by Talos
- [ ] No syntax errors in PHP (test locally)
- [ ] All links working (internal navigation)
- [ ] Assets in correct paths
- [ ] .htaccess routing configured
- [ ] Database API still responding (from employees page)

---

## Deployment Steps

### Step 1: Create Gitea Repository

```bash
# Via Gitea API or CLI
# Organization: TekDekOC
# Repository: companyWebsite
# Description: TekDek Company Website & Documentation
# Visibility: Public
# Initialize with README
```

**Gitea URL**: `http://git.tekdek.dev/TekDekOC/companyWebsite`

### Step 2: Push Code to Gitea

```bash
# Clone empty repo
git clone http://git.tekdek.dev/TekDekOC/companyWebsite.git
cd companyWebsite

# Copy all PHP framework files
cp -r /publish/web1/public/css/ ./css/
cp -r /publish/web1/public/js/ ./js/
cp -r /publish/web1/public/includes/ ./includes/
cp -r /publish/web1/public/pages/ ./pages/
cp -r /publish/web1/public/assets/ ./assets/
cp /publish/web1/public/index.php ./
cp /publish/web1/public/config.php ./
cp /publish/web1/public/.htaccess ./
cp /publish/web1/public/README.md ./

# Add .gitignore
echo "*.log" > .gitignore
echo "temp/" >> .gitignore

# Commit and push
git add -A
git commit -m "Initial deployment: TekDek documentation website"
git push origin main
```

### Step 3: Deploy to Web Server

```bash
# Create docs directory on web server
mkdir -p /publish/web1/public/docs/

# Copy all website files
cp -r companyWebsite/* /publish/web1/public/docs/

# Fix permissions
chmod -R 755 /publish/web1/public/docs/
chmod 644 /publish/web1/public/docs/*.php
chmod 644 /publish/web1/public/docs/css/*.css
chmod 644 /publish/web1/public/docs/js/*.js

# Verify .htaccess is in place
ls -la /publish/web1/public/docs/.htaccess
```

### Step 4: Update Landing Page

Modify or create `/publish/web1/public/index.php` to include:

```php
<?php
// Landing page that links to main sections
// Include top.php from docs
include '/publish/web1/public/docs/includes/top.php';
?>

<div class="container hero" style="text-align: center; padding: 100px 0;">
    <h1>Welcome to TekDek</h1>
    <p>Next-generation narrative-driven developer education</p>
    <nav style="margin-top: 40px;">
        <a href="/docs/" class="btn">Explore Documentation</a>
        <a href="/team.html" class="btn">Meet the Team</a>
    </nav>
</div>

<?php include '/publish/web1/public/docs/includes/bottom.php'; ?>
```

### Step 5: Verify Deployment

Test each endpoint:

```bash
# Test landing page
curl https://web.tekdek.dev/

# Test documentation site
curl https://web.tekdek.dev/docs/
curl https://web.tekdek.dev/docs/about
curl https://web.tekdek.dev/docs/projects
curl https://web.tekdek.dev/docs/team

# Test API still works
curl https://web.tekdek.dev/api/employees/

# Test existing team page
curl https://web.tekdek.dev/team.html

# Check for errors
tail -f /var/log/apache2/error.log
```

### Step 6: Monitor & Document

```bash
# Monitor for 24 hours
# Check error logs hourly
# Verify performance metrics
# Document any issues

# Log deployment
echo "$(date): TekDek documentation website deployed to production" >> /publish/web1/deployment.log
```

---

## Rollback Procedure

If anything breaks:

1. **Identify issue** in logs
2. **Pull previous version** from Gitea
3. **Redeploy** to web server
4. **Verify** all systems working
5. **Document incident**

```bash
# Pull previous version from Gitea
cd companyWebsite
git log --oneline
git checkout <previous-commit>

# Redeploy
cp -r companyWebsite/* /publish/web1/public/docs/

# Verify
curl https://web.tekdek.dev/docs/
```

---

## Post-Deployment Tasks

After successful deployment:

- [ ] Update MEMORY.md with deployment date
- [ ] Add Hephaestus to team page (via Icarus update)
- [ ] Test all links from main site to docs
- [ ] Verify search functionality (if implemented)
- [ ] Check mobile responsiveness on live site
- [ ] Update TekDek-Strategy.md with "Website Live" note
- [ ] Announce to team: "TekDek documentation site is live"

---

## Gitea Repo Structure (Backup)

The companyWebsite repo will contain:

```
TekDekOC/companyWebsite/
├── README.md
├── .gitignore
├── index.php
├── config.php
├── .htaccess
├── css/
│   ├── base.css
│   ├── components.css
│   └── responsive.css
├── js/
│   └── main.js
├── includes/
│   ├── top.php
│   ├── bottom.php
│   ├── menu.php
│   └── functions.php
├── pages/
│   ├── home.php
│   ├── about.php
│   ├── projects.php
│   ├── tools.php
│   ├── team.php
│   ├── decisions.php
│   └── 404.php
└── assets/
    └── [images, icons]
```

This serves as:
1. **Source of truth** for all website code
2. **Fallback copy** for disaster recovery
3. **Version history** for tracking changes
4. **Collaboration space** for future updates

---

## Success Criteria

✅ Website is live at https://web.tekdek.dev/docs/  
✅ All pages load without errors  
✅ Navigation works on mobile and desktop  
✅ Links to team page (team.html) work  
✅ API endpoints still functional  
✅ Code is backed up in Gitea  
✅ Team can access and contribute to Gitea repo  
✅ Rollback procedure tested and documented  

---

## Notes for Hephaestus

This is your first full-stack deployment for TekDek. You're:
1. Creating infrastructure (Gitea repo)
2. Moving code (local → Gitea → web server)
3. Verifying systems (testing all endpoints)
4. Maintaining fallback (Gitea backup)

Execute methodically. Test everything. Document everything.

When this is done, TekDek has a public face: the documentation website. It's the first real thing customers/partners will see.

Make it work flawlessly.
