-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from HannesOberreiter/proto
feat: 🚀 Prototype
- Loading branch information
Showing
33 changed files
with
1,965 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
root = "." | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
bin = "./tmp/main" | ||
cmd = "./tailwindcss -i ./main.css -o ./assets/css/main.css && templ generate && go build -o ./tmp/main ." | ||
delay = 1000 | ||
exclude_dir = ["tmp", "vendor"] | ||
exclude_file = [] | ||
exclude_regex = [".*_templ.go"] | ||
exclude_unchanged = false | ||
follow_symlink = false | ||
full_bin = "" | ||
include_dir = [] | ||
include_ext = ["go", "tpl", "tmpl", "templ", "html", "scss"] | ||
kill_delay = "0s" | ||
log = "build-errors.log" | ||
send_interrupt = false | ||
stop_on_error = true | ||
|
||
[color] | ||
app = "" | ||
build = "yellow" | ||
main = "magenta" | ||
runner = "green" | ||
watcher = "cyan" | ||
|
||
[log] | ||
time = false | ||
|
||
[misc] | ||
clean_on_exit = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vscode | ||
db | ||
tmp | ||
tailwindcss | ||
*.tsv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [HannesOberreiter] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: docker-push | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: hannesoberreiter/gbif-extinct:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Created by https://www.toptal.com/developers/gitignore/api/go,windows,macos,linux | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=go,windows,macos,linux | ||
|
||
### Go ### | ||
# If you prefer the allow list template instead of the deny list, see community template: | ||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore | ||
# | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### macOS Patch ### | ||
# iCloud generated files | ||
*.icloud | ||
|
||
### Windows ### | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/go,windows,macos,linux | ||
|
||
# Custom | ||
Taxon.tsv | ||
tailwindcss | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"releaseCount": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"cSpell.words": [ | ||
"ctx", | ||
"gbif", | ||
"gocron", | ||
"sqlite", | ||
"templ" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. | ||
|
||
## 0.0.1-alpha.0 (2024-02-26) | ||
|
||
|
||
### Features | ||
|
||
* :construction_worker: add docker CI push ([38caff2](https://github.com/HannesOberreiter/gbif-extinct/commit/38caff2f985abe80fb0b189f66f85fe6e3c41ae2)) | ||
* :construction: prototyping ([0901ad8](https://github.com/HannesOberreiter/gbif-extinct/commit/0901ad8f2c1282392c17a14c2f4f5a9746102408)) | ||
* :rocket: Prototype ([becd64a](https://github.com/HannesOberreiter/gbif-extinct/commit/becd64aaea7c38faf0880b4fa68f103734251f69)) | ||
* :sparkles: add compose file ([e475dd2](https://github.com/HannesOberreiter/gbif-extinct/commit/e475dd2553f1374ea5399ddfca35c49c2122bd56)) | ||
* :sparkles: add funding ([7bff602](https://github.com/HannesOberreiter/gbif-extinct/commit/7bff6028bb4fc0fda9f8ffadd49fe5a9ca1d0edb)) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* :bug: reduce max timeout ([dee9574](https://github.com/HannesOberreiter/gbif-extinct/commit/dee9574412613b6214bcb04fe28d431d789b6e43)) | ||
* :see_no_evil: add missing dockerignore ([12b15c5](https://github.com/HannesOberreiter/gbif-extinct/commit/12b15c5271bc61e5e1b4d9dd531eae1ad059220c)) | ||
* :see_no_evil: hide .env ([760c6f6](https://github.com/HannesOberreiter/gbif-extinct/commit/760c6f6e415fcb064114e769bba99516c3a68b72)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM golang:1.22 as build-stage | ||
|
||
WORKDIR /app | ||
|
||
COPY . ./ | ||
|
||
RUN go mod download | ||
|
||
# Build CSS | ||
RUN curl -sL --output tailwindcss https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.1/tailwindcss-linux-x64 | ||
RUN chmod +x tailwindcss | ||
RUN ./tailwindcss -i main.css -o ./assets/css/main.css --minify | ||
|
||
# Build Templates | ||
RUN go install github.com/a-h/templ/cmd/templ@v0 | ||
RUN templ generate | ||
|
||
# We need to build the binaries for duckdb CGO_ENABLED=1 | ||
RUN CGO_ENABLED=1 GOOS=linux go build -o /gbif-extinct | ||
|
||
FROM debian:bookworm-slim as production-stage | ||
|
||
WORKDIR / | ||
|
||
COPY --from=build-stage /gbif-extinct /gbif-extinct | ||
COPY --from=build-stage /app/assets /assets | ||
COPY --from=build-stage /app/migrations /migrations | ||
|
||
EXPOSE 1323 | ||
|
||
CMD ["./gbif-extinct"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# GBIF - Extinct | ||
|
||
Project to keep track of the latest observations for taxa on GBIF. Currently you cannot easily filter for latest observation of multiple taxa on GBIF. This project should help with a plattform to do so. | ||
|
||
## Development | ||
|
||
For ease of development we use [cosmtrek/air](https://github.com/cosmtrek/air) to automatically reload the server when changes are made. See the [config](.air.toml) file for the configuration. | ||
|
||
### Tailwind CSS | ||
|
||
For the frontend we use the standalone version of [Tailwind CSS Standalone CLI](https://tailwindcss.com/blog/standalone-cli). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
main.css |
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
/* Set hidden sorting fields and trigger htmx */ | ||
function setSortingFields(order_by, order_dir) { | ||
console.info('setSortingFields', order_by, order_dir); | ||
document.getElementsByName('order_by')[0].value = order_by; | ||
document.getElementsByName('order_dir')[0].value = order_dir; | ||
htmx.trigger('#filterForm', 'submit'); | ||
} | ||
|
||
/* Update form fields with url query params */ | ||
function updateFields(){ | ||
const url = new URL(window.location.href); | ||
const searchParams = url.searchParams; | ||
console.info('updateFields', url.search); | ||
const filterForm = document.getElementById('filterForm'); | ||
const inputs = filterForm.querySelectorAll('input, select'); | ||
inputs.forEach(input => { | ||
if (searchParams.has(input.name)) { | ||
input.value = searchParams.get(input.name); | ||
} | ||
}); | ||
} | ||
|
||
window.onload = function () { | ||
updateFields(); | ||
}; | ||
|
||
document.body.addEventListener("showMessage", function(evt){ | ||
if(evt.detail.level === "error"){ | ||
alert(evt.detail.message); | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.go |
Oops, something went wrong.