Skip to content

Commit 7281cc1

Browse files
committed
Merge branch 'develop'
2 parents 473e5b5 + b45ad47 commit 7281cc1

8 files changed

Lines changed: 170 additions & 35 deletions

File tree

.DS_Store

-10 KB
Binary file not shown.

.github/workflows/gorelease.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: goreleaser
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
permissions:
7+
contents: write
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- run: git fetch --force --tags
16+
- uses: actions/setup-go@v5
17+
with:
18+
go-version: stable
19+
- name: Generate release notes
20+
continue-on-error: true
21+
run: ./scripts/release-notes.sh ${{github.ref_name}} > ${{runner.temp}}/release_notes.txt
22+
- name: Run GoReleaser
23+
uses: goreleaser/goreleaser-action@v6
24+
with:
25+
distribution: goreleaser
26+
version: "~> v2"
27+
args: release --clean --release-notes=${{runner.temp}}/release_notes.txt
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
6+
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### [v1.0.0]
11+
12+
- Initial stable release. Production ready.

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Sam Laister
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,74 @@
1-
# Go Backend Rest Api for the project
1+
# Model Maker Backend API
22

3-
UPDATE: This repo is outdated. It has been merged with the docker parent repo at: https://github.com/2024-dissertation/model-maker-docker
3+
<img align="right" width="125" src="assets/app-icon.png">
44

5-
## New Method
5+
[![Go Tests](https://github.com/2024-dissertation/go-api/actions/workflows/test.yml/badge.svg)](https://github.com/2024-dissertation/go-api/actions/workflows/test.yml)
66

7-
As of 17/01/25, migrations are now handled with [Goose](https://github.com/pressly/goose) and [Upper.io](https://upper.io/v4/adapter/postgresql/) Postgresql Adapter.
7+
Model Maker is an accessible and Open Source solution to Photogrammetry. This is the backend for the also open source [Flutter App](https://github.com/2024-dissertation/model-maker-app).
88

9-
To migrate up, reset or check status of the database, use the following commands:
9+
Included is a Go REST API with a Dockerfile environment ready for deployment.
1010

11-
- `make db-status` to check the status of the database
12-
- `make up` to migrate up
13-
- `make reset` to reset the database
11+
#### Features
1412

15-
Other commands in the Makefile:
13+
- Works against multiple databases:
14+
- Postgres, MySQL, and more.
15+
- Cross platform.
16+
- Development and Production ready Docker environments.
17+
- `docker-compose-test.yml` will setup a Postgres container and deploy an Ubuntu based enironment for the server executable.
18+
- `docker-compose-dev.yml` will create a continous environment for internal compiling with `make`
19+
- Uses [OpenMVG](https://github.com/openMVG/openMVG) and [OpenMVS](https://github.com/cdcseacave/openMVS).
20+
- Makefile for handling deploying, migrations, running tests.
21+
- Firebase for authentication.
22+
- Environment variables integrations.
23+
- ... and more!
24+
25+
#### Setup
1626

17-
- `make run` to run the server
18-
- `make build` to build the server
19-
- `make seed` to seed the database
27+
Before setting up, a [Google Firebase](https://firebase.google.com/) project must be setup. This project is designed to use the free plan for authentication, so all that'd needed is the `service-account-key.json`.
2028

21-
The .env in app/ is necessary for Makefile to work. Structure is as follows:
29+
Environment variables must be configured, check [/app/.env.example](/app/.env.example) for required keys. It's important to provide the raw json as a string in `GOOGLE_CREDENTIALS`. If running the development environment, the json file should be placed in [/app](/app) and the path updated accordingly. If using the production environment, only the string value needs to be configured.
30+
31+
To run the development environment:
32+
33+
```bash
34+
docker compose -f docker-compose-dev.yml up -d
35+
```
2236

23-
```env
24-
DATABASE_URL=postgres://postgres:postgres@localhost:5432/appdb?sslmode=disable
37+
and the production environment:
2538

26-
MIGRATION_PATH=db/migrations
39+
```bash
40+
docker compose -f docker-compose-test.yml up -d
2741
```
2842

29-
This repo also contains a postres docker, but migrations are still handled through Goose and Go.
43+
**(Note, build times take up to 40 mins on M1 Pro Macbook due to the size of the Photogrammetry tools)**
3044

31-
## Old Method
45+
To rebuild the application in development, the Docker container will stay open without executing the binary. Instead exec in with `docker compose -f docker-compose-dev.yml exec modelmaker bash` and run `make`.
3246

33-
Database is handled with migrations using [Go Migrations CLI Tools](https://github.com/golang-migrate/migrate/blob/master/database/postgres/TUTORIAL.md) and [Upper.io](https://upper.io/v4/adapter/postgresql/) Postgresql Adapter.
47+
In both scenarios, the API will run on port `3333` unless changed in the `.env`.
3448

35-
`brew install golang-migrate`
49+
Example scripts are provided in [/app](/app) called `run.sh` and `build.sh` for deploying and building the docker images.
3650

37-
mirgate with `source .env && migrate -database ${DATABASE_URL} -path migrations up`
51+
#### Migrations
3852

39-
coverter https://developer.apple.com/augmented-reality/tools/
53+
Migrations are handled automatically. Incase manual control is needed, install the tool [Goose](https://github.com/pressly/goose).
54+
55+
To migrate up, reset or check status of the database, use the following commands:
56+
57+
- `make db-status` to check the status of the database
58+
- `make up` to migrate up
59+
- `make reset` to reset the database
60+
61+
Other commands in the Makefile:
4062

41-
datasets: https://github.com/natowi/photogrammetry_datasets
63+
- `make run` to run the server
64+
- `make build` to build the server
65+
- `make seed` to seed the database
4266

43-
## Running the server
67+
#### Documentation
4468

45-
The current routes are as follows:
69+
Documentation is currently in development for the API, as well as a Postman collection. In the meantime, refer to the frontend App.
4670

47-
- POST /verify
48-
- GET /tasks
49-
- POST /tasks
50-
- GET /tasks/:taskID
51-
- POST /tasks/:taskID/upload
52-
- POST /tasks/:taskID/start
53-
- POST /uploads
54-
- GET /uploads/:taskId/:filename
55-
- GET /objects/:taskID/:filename
71+
#### Special Thanks
5672

57-
A postman collection exists to demo these routes.
73+
- **Datasets index**: https://github.com/natowi/photogrammetry_datasets
74+
- **Testing image dataset**: https://www.youtube.com/watch?v=4LexaqdxdiU

app/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ bin/app
3636
uploads/*
3737

3838
.env
39+
40+
SfM_SequentialPipeline.py
3941
cover.html

assets/app-icon.png

56.5 KB
Loading

scripts/release-notes.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Check if the required argument is provided
6+
if [ $# -lt 1 ]; then
7+
echo "Usage: $0 <semver version> [<changelog file>]"
8+
exit 1
9+
fi
10+
11+
version="$1"
12+
changelog_file="${2:-CHANGELOG.md}"
13+
14+
# Check if the changelog file exists
15+
if [ ! -f "$changelog_file" ]; then
16+
echo "Error: $changelog_file does not exist"
17+
exit 1
18+
fi
19+
20+
CAPTURE=0
21+
items=""
22+
# Read the changelog file line by line
23+
while IFS= read -r LINE; do
24+
# Stop capturing when we reach the next version sections
25+
if [[ "${LINE}" == "##"* ]] && [[ "${CAPTURE}" -eq 1 ]]; then
26+
break
27+
fi
28+
# Stop capturing when we reach the Unreleased section
29+
if [[ "${LINE}" == "[Unreleased]"* ]]; then
30+
break
31+
fi
32+
# Start capturing when we reach the specified version section
33+
if [[ "${LINE}" == "## [${version}]"* ]] && [[ "${CAPTURE}" -eq 0 ]]; then
34+
CAPTURE=1
35+
continue
36+
fi
37+
# Capture the lines between the specified version and the next version
38+
if [[ "${CAPTURE}" -eq 1 ]]; then
39+
# Ignore empty lines
40+
if [[ -z "${LINE}" ]]; then
41+
continue
42+
fi
43+
items+="$(echo "${LINE}" | xargs -0)"
44+
# Add a newline between each item
45+
if [[ -n "$items" ]]; then
46+
items+=$'\n'
47+
fi
48+
fi
49+
done <"${changelog_file}"
50+
51+
if [[ -n "$items" ]]; then
52+
echo "${items%$'\n'}"
53+
else
54+
echo "No changelog items found for version $version"
55+
fi

0 commit comments

Comments
 (0)