# Scaleway Deployment Guide for notebook.arnodo.fr This guide explains how to deploy your Hugo website to Scaleway using Gitea Actions and serve it at `notebook.arnodo.fr`. ## Architecture Overview ``` Gitea (gitea.arnodo.fr) → Gitea Actions → Build Hugo → Deploy to Scaleway Object Storage → Served via notebook.arnodo.fr ``` ## Prerequisites - Scaleway account - Scaleway CLI installed (optional but recommended) - Domain `arnodo.fr` with DNS control - Gitea Actions enabled on your Gitea instance ## Step 1: Create Scaleway Object Storage Bucket ### Via Scaleway Console: 1. Go to **Object Storage** in Scaleway console 2. Click **Create a bucket** 3. Name: `notebook-arnodo-fr` (or your choice) 4. Region: `fr-par` (Paris) - recommended for France 5. Click **Create bucket** ### Via Scaleway CLI: ```bash scw object bucket create name=notebook-arnodo-fr region=fr-par ``` ## Step 2: Configure Bucket for Static Website Hosting ### Via Console: 1. Go to your bucket 2. Click **Bucket settings** 3. Enable **Website configuration** 4. Set index document: `index.html` 5. Set error document: `404.html` ### Via CLI: ```bash scw object bucket update notebook-arnodo-fr website-enable=true website-index=index.html website-error=404.html region=fr-par ``` ## Step 3: Create Scaleway API Keys 1. Go to **IAM** → **API Keys** 2. Click **Generate API key** 3. Name it: `gitea-ci-deployment` 4. Save both: - **Access Key ID** - **Secret Access Key** ## Step 4: Configure Bucket Policy for Public Read Create a bucket policy to allow public read access: ```json { "Version": "2023-04-17", "Id": "PublicRead", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "notebook-arnodo-fr/*" } ] } ``` Apply via CLI: ```bash cat > policy.json << EOF { "Version": "2023-04-17", "Id": "PublicRead", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "notebook-arnodo-fr/*" } ] } EOF scw object bucket update notebook-arnodo-fr --policy=@policy.json region=fr-par ``` ## Step 5: Configure Gitea Secrets Add these secrets to your Gitea repository: 1. Go to your Notebook repository in Gitea 2. Navigate to **Settings** → **Secrets** 3. Add the following secrets: - `SCW_ACCESS_KEY`: Your Scaleway Access Key - `SCW_SECRET_KEY`: Your Scaleway Secret Key - `SCW_BUCKET_NAME`: `notebook-arnodo-fr` ## Step 6: DNS Configuration ### Option A: Direct S3 Bucket Access (Simple) Add a CNAME record: ``` notebook.arnodo.fr CNAME notebook-arnodo-fr.s3-website.fr-par.scw.cloud. ``` **Note**: The bucket URL will be: `http://notebook-arnodo-fr.s3-website.fr-par.scw.cloud` ### Option B: Using Scaleway CDN (Recommended for Production) 1. Go to **Scaleway CDN** in console 2. Create a new CDN endpoint 3. Origin: Your bucket endpoint 4. Custom domain: `notebook.arnodo.fr` 5. Enable SSL/TLS 6. Add CNAME record as provided by Scaleway ### Option C: Using Nginx Reverse Proxy on Scaleway Instance If you want more control: 1. Create a Scaleway Instance (smallest one: DEV1-S) 2. Install Nginx 3. Configure Nginx to proxy to your S3 bucket Nginx config example: ```nginx server { listen 80; server_name notebook.arnodo.fr; location / { proxy_pass http://notebook-arnodo-fr.s3-website.fr-par.scw.cloud; proxy_set_header Host notebook-arnodo-fr.s3-website.fr-par.scw.cloud; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ``` 4. Set up Let's Encrypt for HTTPS: ```bash sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d notebook.arnodo.fr ``` ## Step 7: Test the Deployment 1. Commit and push to the `main` branch 2. Check Gitea Actions for build status 3. Verify files are uploaded to Scaleway bucket 4. Access your site at `notebook.arnodo.fr` ## Verification Commands Check bucket contents: ```bash s3cmd ls s3://notebook-arnodo-fr/ ``` Test website endpoint: ```bash curl -I http://notebook-arnodo-fr.s3-website.fr-par.scw.cloud ``` ## Cost Estimation (Scaleway) ### Object Storage: - Storage: €0.01 per GB/month - Outbound traffic: First 75 GB free, then €0.01 per GB - Typical blog (1 GB): ~€0.01/month + traffic ### Optional Instance (if using reverse proxy): - DEV1-S: ~€0.01/hour (~€7/month) - With 100% uptime SLA: ~€10/month ### CDN (if needed): - €1/month base + traffic costs ## Troubleshooting ### Build fails in Gitea Actions - Check Hugo version compatibility - Verify theme submodules are properly checked out - Check build logs in Gitea Actions tab ### Files not accessible - Verify bucket policy allows public read - Check bucket website configuration - Ensure files were uploaded (check s3cmd output) ### DNS not resolving - Wait for DNS propagation (up to 48 hours, usually minutes) - Verify CNAME record with: `dig notebook.arnodo.fr` - Check TTL settings ### SSL Certificate Issues - If using reverse proxy, ensure Certbot ran successfully - If using CDN, verify SSL certificate provisioning in Scaleway console ## Migration from GitHub Pages 1. Remove GitHub Actions workflow (or keep both temporarily) 2. Update any hardcoded URLs in your Hugo config 3. Verify all functionality works on Scaleway 4. Update DNS from GitHub Pages to Scaleway 5. Remove GitHub Pages when satisfied ## Advanced: Cache Invalidation If using Scaleway CDN, add cache invalidation to workflow: ```bash # Install Scaleway CLI in workflow - name: Install Scaleway CLI run: | curl -o /usr/local/bin/scw -L "https://github.com/scaleway/scaleway-cli/releases/latest/download/scaleway-cli_$(uname -s)_$(uname -m)" chmod +x /usr/local/bin/scw - name: Invalidate CDN cache run: | scw edge invalidate path=/* zone=fr-par env: SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }} SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }} ``` ## Monitoring Set up Scaleway monitoring: 1. Enable bucket metrics in Scaleway console 2. Configure alerts for: - High traffic usage - Failed requests - Storage size ## Backup Strategy While Object Storage is highly durable, consider: 1. Git repository is your source of truth 2. Enable Object Storage versioning 3. Consider cross-region replication for critical sites ## Next Steps 1. Enable HTTPS (via CDN or reverse proxy) 2. Configure custom error pages 3. Set up monitoring and alerts 4. Optimize images and assets 5. Consider adding a CDN for global performance --- For questions or issues, refer to: - [Scaleway Object Storage Docs](https://www.scaleway.com/en/docs/storage/object/) - [Hugo Documentation](https://gohugo.io/documentation/) - [Gitea Actions Documentation](https://docs.gitea.com/usage/actions)