Skip to content

Commit

Permalink
Fix deployment issues
Browse files Browse the repository at this point in the history
  • Loading branch information
goodwillhacking committed Jun 11, 2024
1 parent 1775c9e commit 94dddca
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 41 deletions.
32 changes: 20 additions & 12 deletions .do/app.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
name: goodwill-hacking
region: nyc
alerts:
- rule: DEPLOYMENT_LIVE
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED

ingress:
rules:
- component:
Expand All @@ -14,14 +16,20 @@ ingress:
path:
prefix: /

name: goodwill-hacking
region: nyc
services:
static_sites:
- build_command: hugo --config hugo.toml --destination ./public
environment_slug: hugo
github:
branch: dev
deploy_on_push: true
repo: goodwillhacking/website
name: website
static_sites:
- name: website
environment_slug: hugo
github:
branch: dev
deploy_on_push: true
repo: goodwillhacking/website
envs:
- key: HUGO_VERSION
value: "0.127.0"
scope: BUILD_TIME
type: GENERAL
- key: HUGO_EXTENDED
value: "1"
scope: BUILD_TIME
type: GENERAL
build_command: git submodule add -f https://github.com/khusika/FeelIt.git themes/FeelIt; hugo --config hugo.toml --destination ./public
27 changes: 0 additions & 27 deletions .do/deploy.template.yml

This file was deleted.

31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Description
Static Site generated with Hugo and hosted on Digitalocean app platform.

## Theme
The website relies on the FeelIt theme which can be found [here](https://github.com/khusika/FeelIt). Many thanks to Khusika

### Theme documentation
[FeelIt Documentation](https://feelit.khusika.dev/categories/documentation/)

## Testing

### Development mode
Note: Ensure you are using the extended version of Hugo with Sass/SCSS support,
```bash
hugo serve --disableFastRender --config hugo.toml
```
### Build mode
Use Docker to locally test website builds
```bash
hugo --config hugo.toml
```

## Deploying the App to Digital Ocean
```bash
doctl app create --spec .do/app.yml

doctl apps update <app_id> --spec .do/app.yml
```
https://docs.digitalocean.com/products/app-platform/reference/buildpacks/hugo/
https://docs.digitalocean.com/products/app-platform/reference/app-spec/

2 changes: 2 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Add so DigitalOcean can recognize it as a hugo project.
# https://docs.digitalocean.com/products/app-platform/reference/buildpacks/hugo/
32 changes: 32 additions & 0 deletions docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -ex

if ! command -v docker &> /dev/null; then
echo "Error: Docker unavailable."
exit 1
fi

if ! docker ps -q > /dev/null 2>&1; then
echo "Error: Docker not running."
exit 1
fi

if ! command -v hugo &> /dev/null; then
echo "Error: Hugo unavilable."
exit 1
fi

# Pull the latest nginx image
docker pull nginx:latest

# Build
hugo --config hugo.toml

# Run the container with desired options
docker run --name website \
-d \
-p 8080:80 \
-v "$(pwd)/public:/usr/share/nginx/html:ro" \
nginx

echo "Nginx container 'website' started!"
4 changes: 2 additions & 2 deletions hugo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
baseURL = "nicholas.karonji.org"
baseURL = ""
defaultContentLanguage = "en"
# language code
languageCode = "en"
Expand All @@ -13,7 +13,7 @@ theme = "FeelIt"
pre = "<i class='fa-solid fa-user fa-fw'></i>"
post = ""
name = "About"
url = "/about"
url = "/about/"
title = ""
weight = 1
[[menu.main]]
Expand Down

0 comments on commit 94dddca

Please sign in to comment.