This is the portion of the VidToNerf backend responsible for HTTP communication, worker job delegation, and database management. This is a rewrite of the python flask webserver with expanded functionality.
We are always looking for help to improve NeRF-or-Nothing!
As this repository is only a single service in the greater system architecture, consider visiting the Complete Backend and Frontend.
Most of our services are expected to run in their own docker container, this included.
If you want to contribute to the code base, we suggest reading the Wiki First, and then diving deeper into the go doc's and code base.
Note: It's recommended to instead follow the run instructions for the Complete Backend
Make sure you have the following installed and running on their respective URLs.
- MongoDB
- RabbitMQ
-
Clone the repository:
git clone https://github.com/NeRF-or-Nothing/go-web-server.git cd go-web-server
-
Set up your environment variables: Create a
.env
file in./secrets
and add the following:MONGO_INITDB_ROOT_USERNAME=your_mongodb_username MONGO_INITDB_ROOT_PASSWORD=your_mongodb_password RABBITMQ_DEFAULT_USER=your_rabbitmq_username RABBITMQ_DEFAULT_PASS=your_rabbitmq_password JWT_SECRET=your_jwt_secret
(Psst, our code should be resistent to ENV vars passed from overarching docker compose and those locally defined, but precedence goes to compose)
Make sure you have the following installed:
- Docker
- Build and run the image
docker build -t web-server
docker run web-server
Make sure you have the following installed:
- Go (version 1.22 or later)
-
Install dependencies:
go mod download
-
Build the project:
go build ./cmd/main
-
Run the server:
./main
This guide will help you get started with contributing to our project.
- Join our Discord
- Find out what you can do to help directly from the team
- Start attending RCOS
/cmd/webserver
: Main application entry point/internal
: Internal packages/log
: Logging utilities/models
: Data models and database managers/services
: Business logic and services
/web
: Web server and HTTP handlers
- WebServer: Handles HTTP requests and routes them to appropriate handlers.
- ClientService: Manages business logic for client requests.
- AMPQService: Handles communication with RabbitMQ for job processing.
- SceneManager: Manages scene data in the database.
- UserManager: Handles user-related operations.
- QueueListManager: Manages processing queues.
-
Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name
-
Make your changes and commit them:
git add . git commit -m "Add your commit message here"
-
Push your changes to your fork:
git push origin feature/your-feature-name
-
Create a pull request on GitHub.
Run the tests using:
go test ./...
We follow the standard Go code style. Please run gofmt
on your code before submitting a pull request:
gofmt -w .
- Please update the relevant documentation when making changes.
- Add comments to your code, especially for complex logic.
If you have any questions or need help, please:
- Check the existing issues on GitHub.
- If you can't find an answer, create a new issue with your question.
- Reach out in our Discord