Init
This commit is contained in:
544
Personal/Projects/Servers/Oracle Cloud/IMPLEMENTATION_PLAN.md
Normal file
544
Personal/Projects/Servers/Oracle Cloud/IMPLEMENTATION_PLAN.md
Normal file
@@ -0,0 +1,544 @@
|
||||
# Oracle Cloud iPad Development Environment - Implementation Plan
|
||||
|
||||
**Last Updated:** 2025-10-25
|
||||
**Status:** Ready to Build
|
||||
|
||||
## What We're Building
|
||||
|
||||
A cloud-based development environment accessible from iPad, hosted on Oracle Cloud Free Tier:
|
||||
|
||||
- **Git Server** (Gitea) - Host your knowledge repository with web UI
|
||||
- **VS Code Server** (code-server) - Full VS Code in browser with Claude Code extension
|
||||
- **Container Management** (CapRover) - One-click deployment platform for additional apps
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Oracle Cloud Free Tier - ARM VM (4 cores, 24GB RAM)
|
||||
├── Ubuntu 22.04 LTS (ARM64)
|
||||
├── Docker Engine
|
||||
└── CapRover PaaS Platform
|
||||
├── captain.yourdomain.com → CapRover dashboard
|
||||
├── git.yourdomain.com → Gitea (Git server)
|
||||
└── code.yourdomain.com → code-server (VS Code + Claude Code)
|
||||
```
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology | Purpose | Resources |
|
||||
|-----------|-----------|---------|-----------|
|
||||
| **Infrastructure** | Oracle Cloud (ARM VM) | Free hosting | 4 cores, 24GB RAM, 200GB storage |
|
||||
| **OS** | Ubuntu 22.04 LTS ARM64 | Server operating system | ~2GB |
|
||||
| **Container Runtime** | Docker Engine | Run containers | Required by CapRover |
|
||||
| **Platform** | CapRover | PaaS + app deployment | ~300MB RAM |
|
||||
| **Git Server** | Gitea v1.21.1 | Self-hosted GitHub alternative | ~200MB RAM |
|
||||
| **Code Editor** | code-server | VS Code in browser | ~500MB RAM |
|
||||
| **AI Assistant** | Claude Code extension | AI-powered coding | VS Code extension |
|
||||
| **DNS** | Cloudflare | Domain management | Existing domain |
|
||||
| **SSL** | Let's Encrypt (via CapRover) | Automatic HTTPS | Free |
|
||||
|
||||
**Total base resource usage:** ~1GB RAM, ~10GB storage
|
||||
**Remaining available:** ~23GB RAM, ~190GB storage
|
||||
|
||||
## Implementation Phases
|
||||
|
||||
### Phase 1: Oracle Cloud Setup (1-2 hours)
|
||||
|
||||
**Objective:** Provision and secure the ARM VM
|
||||
|
||||
- [ ] Create Oracle Cloud account (if needed)
|
||||
- [ ] Provision ARM VM instance:
|
||||
- Shape: VM.Standard.A1.Flex
|
||||
- OCPU: 4
|
||||
- RAM: 24GB
|
||||
- Boot volume: 50GB (default)
|
||||
- Image: Ubuntu 22.04 LTS (ARM64)
|
||||
- Region: Choose based on availability
|
||||
- [ ] Configure Oracle Security Lists (firewall):
|
||||
- Allow inbound: 22 (SSH), 80 (HTTP), 443 (HTTPS), 3000 (CapRover initial setup)
|
||||
- Allow inbound: 996, 7946, 4789, 2377 (CapRover/Docker Swarm)
|
||||
- [ ] Note public IP address
|
||||
- [ ] Set up SSH key authentication
|
||||
- [ ] SSH into VM and verify access
|
||||
|
||||
**Deliverable:** Accessible Ubuntu VM with public IP
|
||||
|
||||
---
|
||||
|
||||
### Phase 2: Server Foundation (30 minutes)
|
||||
|
||||
**Objective:** Install Docker and prepare for CapRover
|
||||
|
||||
```bash
|
||||
# Update system
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
|
||||
# Install Docker Engine
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sudo sh get-docker.sh
|
||||
|
||||
# Add user to docker group
|
||||
sudo usermod -aG docker $USER
|
||||
newgrp docker
|
||||
|
||||
# Verify Docker installation
|
||||
docker --version
|
||||
docker run hello-world
|
||||
|
||||
# Configure firewall (UFW)
|
||||
sudo ufw allow 22/tcp
|
||||
sudo ufw allow 80/tcp
|
||||
sudo ufw allow 443/tcp
|
||||
sudo ufw allow 3000/tcp
|
||||
sudo ufw allow 996/tcp
|
||||
sudo ufw allow 7946/tcp
|
||||
sudo ufw allow 4789/tcp
|
||||
sudo ufw allow 2377/tcp
|
||||
sudo ufw enable
|
||||
|
||||
# Enable automatic security updates
|
||||
sudo apt install unattended-upgrades -y
|
||||
sudo dpkg-reconfigure -plow unattended-upgrades
|
||||
```
|
||||
|
||||
**Deliverable:** VM with Docker installed and firewall configured
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: DNS Configuration (10 minutes)
|
||||
|
||||
**Objective:** Point domain to Oracle VM
|
||||
|
||||
In Cloudflare DNS:
|
||||
|
||||
1. Add A record for wildcard subdomain:
|
||||
- Type: `A`
|
||||
- Name: `*` (wildcard) or `*.oracle` (if you want subdomain)
|
||||
- Content: `YOUR_ORACLE_VM_PUBLIC_IP`
|
||||
- Proxy status: DNS only (orange cloud OFF)
|
||||
- TTL: Auto
|
||||
|
||||
2. Verify DNS propagation:
|
||||
```bash
|
||||
# From your local machine
|
||||
nslookup captain.yourdomain.com
|
||||
nslookup git.yourdomain.com
|
||||
nslookup code.yourdomain.com
|
||||
```
|
||||
|
||||
**Deliverable:** DNS records pointing to Oracle VM
|
||||
|
||||
---
|
||||
|
||||
### Phase 4: CapRover Installation (15 minutes)
|
||||
|
||||
**Objective:** Install and configure CapRover PaaS platform
|
||||
|
||||
```bash
|
||||
# Install CapRover
|
||||
docker run -p 80:80 -p 443:443 -p 3000:3000 \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /captain:/captain \
|
||||
-e ACCEPTED_TERMS=true \
|
||||
caprover/caprover
|
||||
|
||||
# Wait ~2 minutes for CapRover to initialize
|
||||
|
||||
# Access CapRover setup wizard
|
||||
# Open browser: http://YOUR_VM_IP:3000
|
||||
```
|
||||
|
||||
**CapRover Initial Setup Wizard:**
|
||||
|
||||
1. **Password:** Set a strong password (save it!)
|
||||
2. **Root Domain:** `yourdomain.com` (or `oracle.yourdomain.com`)
|
||||
3. **Email:** Your email for Let's Encrypt SSL
|
||||
4. **Enable HTTPS:** ✅ Yes
|
||||
5. **Force HTTPS:** ✅ Yes
|
||||
|
||||
**Post-setup:**
|
||||
- Access dashboard at: `https://captain.yourdomain.com`
|
||||
- Login with the password you set
|
||||
- Verify SSL certificate is working
|
||||
|
||||
**Deliverable:** Running CapRover platform with HTTPS
|
||||
|
||||
---
|
||||
|
||||
### Phase 5: Deploy Gitea (10 minutes)
|
||||
|
||||
**Objective:** Deploy Git server via CapRover one-click app
|
||||
|
||||
**In CapRover Dashboard:**
|
||||
|
||||
1. Navigate to **Apps** → **One-Click Apps/Databases**
|
||||
2. Search for **Gitea**
|
||||
3. Configure:
|
||||
- **App Name:** `git` (becomes git.yourdomain.com)
|
||||
- **Gitea Version:** `1.21.1` (default, or latest)
|
||||
- **MySQL Version:** `8.0.32` (default)
|
||||
- **MySQL Root Password:** Auto-generated (or custom)
|
||||
4. Click **Deploy**
|
||||
5. Wait ~2 minutes for deployment
|
||||
|
||||
**Initial Gitea Setup:**
|
||||
|
||||
1. Open `https://git.yourdomain.com`
|
||||
2. Complete Gitea installation wizard:
|
||||
- **Database Type:** MySQL (pre-configured by CapRover)
|
||||
- **Database Host:** Auto-configured
|
||||
- **Site Title:** "Your Name's Git Server" or similar
|
||||
- **Server Domain:** `git.yourdomain.com`
|
||||
- **SSH Port:** 22 (or custom if needed)
|
||||
- **Base URL:** `https://git.yourdomain.com/`
|
||||
- **Admin Account:**
|
||||
- Username: Your username
|
||||
- Password: Strong password
|
||||
- Email: Your email
|
||||
3. Click **Install Gitea**
|
||||
4. Login with admin account
|
||||
|
||||
**Create Your Knowledge Repository:**
|
||||
|
||||
1. Click **+** → **New Repository**
|
||||
2. Repository name: `knowledge-base` (or your preferred name)
|
||||
3. Make it private
|
||||
4. Initialize with README
|
||||
5. Create repository
|
||||
|
||||
**Deliverable:** Working Gitea instance with your repository
|
||||
|
||||
---
|
||||
|
||||
### Phase 6: Deploy code-server (10 minutes)
|
||||
|
||||
**Objective:** Deploy VS Code Server via CapRover one-click app
|
||||
|
||||
**In CapRover Dashboard:**
|
||||
|
||||
1. Navigate to **Apps** → **One-Click Apps/Databases**
|
||||
2. Search for **code-server**
|
||||
3. Configure:
|
||||
- **App Name:** `code` (becomes code.yourdomain.com)
|
||||
- **Password:** Set a strong password for code-server access
|
||||
- **Sudo Password:** (Optional) For terminal sudo access
|
||||
4. Click **Deploy**
|
||||
5. Wait ~2 minutes for deployment
|
||||
|
||||
**Access code-server:**
|
||||
|
||||
1. Open `https://code.yourdomain.com`
|
||||
2. Enter the password you set
|
||||
3. You should see VS Code interface in browser!
|
||||
|
||||
**Deliverable:** Working code-server accessible via browser
|
||||
|
||||
---
|
||||
|
||||
### Phase 7: Configure Development Environment (30 minutes)
|
||||
|
||||
**Objective:** Set up code-server with Claude Code and clone your repo
|
||||
|
||||
**7.1 Configure Git in code-server:**
|
||||
|
||||
Open terminal in code-server (`` Ctrl+` `` or Terminal menu):
|
||||
|
||||
```bash
|
||||
# Set up git identity
|
||||
git config --global user.name "Your Name"
|
||||
git config --global user.email "your@email.com"
|
||||
|
||||
# Generate SSH key for Gitea
|
||||
ssh-keygen -t ed25519 -C "your@email.com"
|
||||
# Press Enter for default location, set passphrase (optional)
|
||||
|
||||
# Copy public key
|
||||
cat ~/.ssh/id_ed25519.pub
|
||||
```
|
||||
|
||||
**Add SSH key to Gitea:**
|
||||
1. Copy the public key output
|
||||
2. Go to Gitea (`git.yourdomain.com`)
|
||||
3. Click your profile → **Settings** → **SSH / GPG Keys**
|
||||
4. Click **Add Key**
|
||||
5. Paste the public key
|
||||
6. Give it a title (e.g., "code-server")
|
||||
7. Click **Add Key**
|
||||
|
||||
**7.2 Clone your repository:**
|
||||
|
||||
In code-server terminal:
|
||||
|
||||
```bash
|
||||
# Clone your knowledge repo
|
||||
cd ~
|
||||
git clone git@git.yourdomain.com:YOUR_USERNAME/knowledge-base.git
|
||||
|
||||
# Open the repository in code-server
|
||||
code knowledge-base
|
||||
```
|
||||
|
||||
**7.3 Install Claude Code extension:**
|
||||
|
||||
1. Click **Extensions** icon (left sidebar) or `Ctrl+Shift+X`
|
||||
2. Search: "Claude Code" or "Anthropic"
|
||||
3. Click **Install** on the Claude Code extension
|
||||
4. After installation, you'll be prompted to authenticate
|
||||
5. Enter your Anthropic API key or login to Claude Pro
|
||||
|
||||
**Verify Claude Code is working:**
|
||||
- Open a file in your repository
|
||||
- Try asking Claude a question about your code
|
||||
- Test code completion features
|
||||
|
||||
**7.4 Optional: Install additional extensions:**
|
||||
- Markdown Preview Enhanced
|
||||
- GitLens
|
||||
- Any other extensions you use
|
||||
|
||||
**Deliverable:** Fully configured development environment with Claude Code
|
||||
|
||||
---
|
||||
|
||||
### Phase 8: iPad Setup (5 minutes)
|
||||
|
||||
**Objective:** Install code-server as PWA on iPad for native-like experience
|
||||
|
||||
**On your iPad:**
|
||||
|
||||
1. Open Safari
|
||||
2. Navigate to `https://code.yourdomain.com`
|
||||
3. Login with your password
|
||||
4. Tap the **Share** button (square with arrow)
|
||||
5. Scroll down and tap **Add to Home Screen**
|
||||
6. Name it "Cloud Code" or "Code Server"
|
||||
7. Tap **Add**
|
||||
8. Find the app icon on your home screen
|
||||
9. Tap to open (full-screen experience!)
|
||||
|
||||
**Benefits of PWA mode:**
|
||||
- No Safari UI bars (more screen space)
|
||||
- Runs like a native app
|
||||
- Better keyboard integration
|
||||
- Quick access from home screen/dock
|
||||
|
||||
**Deliverable:** Code-server installed as PWA on iPad
|
||||
|
||||
---
|
||||
|
||||
### Phase 9: Backup & Security (1 hour)
|
||||
|
||||
**Objective:** Secure the environment and set up backups
|
||||
|
||||
**9.1 SSH Hardening:**
|
||||
|
||||
```bash
|
||||
# Change SSH port (optional but recommended)
|
||||
sudo nano /etc/ssh/sshd_config
|
||||
# Change: Port 22 → Port 2222
|
||||
# Set: PasswordAuthentication no
|
||||
# Set: PermitRootLogin no
|
||||
|
||||
sudo systemctl restart sshd
|
||||
|
||||
# Update Oracle Security Lists to allow port 2222 instead of 22
|
||||
# Update UFW: sudo ufw allow 2222/tcp && sudo ufw delete allow 22/tcp
|
||||
```
|
||||
|
||||
**9.2 Configure Backups:**
|
||||
|
||||
Create backup script:
|
||||
|
||||
```bash
|
||||
# Create backup directory
|
||||
mkdir -p /home/ubuntu/backups
|
||||
|
||||
# Create backup script
|
||||
cat > /home/ubuntu/backup.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
BACKUP_DIR="/home/ubuntu/backups"
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
# Backup Gitea data
|
||||
docker exec srv-captain--git tar czf /tmp/gitea-backup-${DATE}.tar.gz /data
|
||||
docker cp srv-captain--git:/tmp/gitea-backup-${DATE}.tar.gz ${BACKUP_DIR}/
|
||||
|
||||
# Backup code-server data
|
||||
docker exec srv-captain--code tar czf /tmp/code-backup-${DATE}.tar.gz /home/coder
|
||||
docker cp srv-captain--code:/tmp/code-backup-${DATE}.tar.gz ${BACKUP_DIR}/
|
||||
|
||||
# Keep only last 7 days of backups
|
||||
find ${BACKUP_DIR} -name "*.tar.gz" -mtime +7 -delete
|
||||
|
||||
echo "Backup completed: ${DATE}"
|
||||
EOF
|
||||
|
||||
chmod +x /home/ubuntu/backup.sh
|
||||
|
||||
# Set up cron job (daily at 2 AM)
|
||||
(crontab -l 2>/dev/null; echo "0 2 * * * /home/ubuntu/backup.sh >> /home/ubuntu/backup.log 2>&1") | crontab -
|
||||
```
|
||||
|
||||
**9.3 Oracle Block Volume Setup (Optional):**
|
||||
|
||||
If you want persistent storage separate from boot volume:
|
||||
|
||||
1. Create 100GB block volume in Oracle Cloud console
|
||||
2. Attach to VM instance
|
||||
3. Format and mount:
|
||||
```bash
|
||||
sudo mkfs.ext4 /dev/sdb
|
||||
sudo mkdir /mnt/data
|
||||
sudo mount /dev/sdb /mnt/data
|
||||
sudo chown ubuntu:ubuntu /mnt/data
|
||||
|
||||
# Add to fstab for persistence
|
||||
echo "/dev/sdb /mnt/data ext4 defaults 0 0" | sudo tee -a /etc/fstab
|
||||
```
|
||||
4. Move Docker volumes to block storage:
|
||||
```bash
|
||||
sudo systemctl stop docker
|
||||
sudo mv /var/lib/docker /mnt/data/docker
|
||||
sudo ln -s /mnt/data/docker /var/lib/docker
|
||||
sudo systemctl start docker
|
||||
```
|
||||
|
||||
**Deliverable:** Secured and backed-up environment
|
||||
|
||||
---
|
||||
|
||||
### Phase 10: Deploy Monitoring (Optional, 15 minutes)
|
||||
|
||||
**Objective:** Monitor your services with Uptime Kuma
|
||||
|
||||
**In CapRover Dashboard:**
|
||||
|
||||
1. **Apps** → **One-Click Apps/Databases**
|
||||
2. Search: **Uptime Kuma**
|
||||
3. Configure:
|
||||
- App Name: `uptime`
|
||||
4. Deploy
|
||||
5. Access: `https://uptime.yourdomain.com`
|
||||
6. Create admin account
|
||||
7. Add monitors for:
|
||||
- Gitea (`https://git.yourdomain.com`)
|
||||
- code-server (`https://code.yourdomain.com`)
|
||||
- CapRover (`https://captain.yourdomain.com`)
|
||||
|
||||
**Deliverable:** Monitoring dashboard for all services
|
||||
|
||||
---
|
||||
|
||||
## Final Verification Checklist
|
||||
|
||||
- [ ] CapRover dashboard accessible at `https://captain.yourdomain.com`
|
||||
- [ ] Gitea accessible at `https://git.yourdomain.com` with your repository
|
||||
- [ ] code-server accessible at `https://code.yourdomain.com`
|
||||
- [ ] code-server has Claude Code extension installed and working
|
||||
- [ ] Repository cloned in code-server
|
||||
- [ ] Can commit and push from code-server to Gitea
|
||||
- [ ] code-server installed as PWA on iPad
|
||||
- [ ] All services have valid SSL certificates
|
||||
- [ ] SSH hardened (port changed, password auth disabled)
|
||||
- [ ] Backups configured and tested
|
||||
- [ ] (Optional) Monitoring set up
|
||||
|
||||
## Workflow: Using Your iPad Dev Environment
|
||||
|
||||
**Daily workflow:**
|
||||
|
||||
1. **On iPad:** Open "Cloud Code" PWA from home screen
|
||||
2. **Edit files:** Make changes to your knowledge base
|
||||
3. **Use Claude Code:** Get AI assistance while coding
|
||||
4. **Commit changes:**
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "Update notes on X"
|
||||
git push
|
||||
```
|
||||
5. **View in Gitea:** Check `https://git.yourdomain.com` to see changes
|
||||
|
||||
**From any device:**
|
||||
- Access code-server: `https://code.yourdomain.com`
|
||||
- Browse repo in web: `https://git.yourdomain.com`
|
||||
- Manage apps: `https://captain.yourdomain.com`
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**CapRover not accessible:**
|
||||
- Check Oracle Security Lists (firewall rules)
|
||||
- Check UFW: `sudo ufw status`
|
||||
- Check CapRover status: `docker ps`
|
||||
|
||||
**SSL certificate issues:**
|
||||
- Ensure DNS is propagated: `nslookup captain.yourdomain.com`
|
||||
- Check Cloudflare proxy is OFF (DNS only)
|
||||
- Wait 5-10 minutes for Let's Encrypt
|
||||
|
||||
**code-server can't clone from Gitea:**
|
||||
- Verify SSH key added to Gitea
|
||||
- Test SSH: `ssh -T git@git.yourdomain.com`
|
||||
- Check git config: `git config --list`
|
||||
|
||||
**Claude Code extension not working:**
|
||||
- Verify API key is valid
|
||||
- Check extension logs in code-server
|
||||
- Try reinstalling extension
|
||||
|
||||
## Cost Breakdown
|
||||
|
||||
| Item | Cost |
|
||||
|------|------|
|
||||
| Oracle Cloud ARM VM | $0 (Free Tier) |
|
||||
| Oracle Block Storage (200GB) | $0 (Free Tier) |
|
||||
| Cloudflare DNS | $0 (Free Plan) |
|
||||
| Domain (if you don't have one) | ~$10-15/year |
|
||||
| Let's Encrypt SSL | $0 (Free) |
|
||||
| **Total Monthly Cost** | **$0** |
|
||||
|
||||
## Maintenance
|
||||
|
||||
**Weekly:**
|
||||
- Check backups are running: `ls -lh /home/ubuntu/backups`
|
||||
- Review service health in Uptime Kuma (if installed)
|
||||
|
||||
**Monthly:**
|
||||
- Update Docker containers via CapRover
|
||||
- Review disk space: `df -h`
|
||||
- Test backup restoration
|
||||
|
||||
**As needed:**
|
||||
- Update CapRover: Follow official upgrade guide
|
||||
- Add new apps via CapRover one-click marketplace
|
||||
|
||||
## Next Steps After Setup
|
||||
|
||||
**Additional apps you might want to deploy (all one-click in CapRover):**
|
||||
|
||||
- **Vaultwarden** - Self-hosted password manager
|
||||
- **FreshRSS** - RSS feed reader
|
||||
- **Nextcloud** - File storage and sync
|
||||
- **Bookstack** - Documentation wiki
|
||||
- **Plausible** - Privacy-friendly analytics
|
||||
- **Miniflux** - Minimal RSS reader
|
||||
- **Dokuwiki** - Simple wiki
|
||||
- **Jellyfin** - Media server
|
||||
|
||||
All available via CapRover's one-click apps marketplace!
|
||||
|
||||
## Success Criteria
|
||||
|
||||
You'll know the setup is successful when you can:
|
||||
|
||||
1. ✅ Open code-server on your iPad (as PWA)
|
||||
2. ✅ Clone and edit your knowledge repository
|
||||
3. ✅ Use Claude Code extension to get AI assistance
|
||||
4. ✅ Commit and push changes back to Gitea
|
||||
5. ✅ Access everything via HTTPS from anywhere
|
||||
6. ✅ Deploy new apps with one click in CapRover
|
||||
|
||||
**Estimated total setup time:** 3-4 hours (including wait times)
|
||||
|
||||
---
|
||||
|
||||
**Ready to start building?** Begin with Phase 1!
|
||||
Reference in New Issue
Block a user