TestyCool Server
This project is currently WIP and under heavy development.
Executable documentation is available with --help
flag:
$ testycool-server --help
Usage:
testycool-server [OPTIONS]
Application Options:
--passcode= Passcode to access admin privileges on this server [$ADMIN_PASSCODE]
--verbose Enable verbose debug information and show request log (if enabled) to stdout
--data-dir= Directory to store runtime data (default: data)
--database=[sqlite] Database to use (default: sqlite)
-v, --version Show version and exit
gRPC Options:
-H, --grpc-host= Address for gRPC to listen on (default: localhost) [$GRPC_HOST]
-p, --grpc-port= gRPC listening port (default: 50051) [$GRPC_PORT]
--grpc-reflection Enable gRPC reflection service
--grpc-log-requests Enable gRPC requests logging [$GRPC_LOG_REQUESTS]
SQLite Options:
--sqlite-pool-size= SQLite connection pool count (default: 1000) [$SQLITE_POOL_SIZE]
Help Options:
-h, --help Show this help message
As per --help
flag, administrator passcode can also be set via environment variable ADMIN_PASSCODE
. If both are set,
the environment variable takes precedence. Also, if neither is set, the default passcode will be randomly generated.
Building
Tools for building the binaries:
- Go version 1.17.x
- GNU Make version 4.3+
- Bash or Bash compatible shell e.g. Zsh
Setup project dependencies for building:
$ make setup
Build the project:
$ make
Binary will be stored in dist/
directory. The resulting binary is development build version without stripping and
compression for development and testing. See Packaging to build with binary stripping and compression for
distribution.
To build for different platform, set GOOS
and GOARCH
environment variables to target platform. For example, if the
target is Windows x86_64:
$ GOOS=windows GOARCH=amd64 make
Supported platforms:
GOOS |
GOARCH |
darwin |
amd64 |
darwin |
arm64 |
linux |
386 |
linux |
amd64 |
linux |
arm |
linux |
arm64 |
windows |
amd64 |
Packaging
Tools for packaging:
- Tools for building
- Git
- UPX for executable compression
- (Optional) Docker for building docker image
Build and package the project for single target:
$ make package
Example to package for different target:
$ GOOS=windows GOARCH=amd64 make package
Artifacts will be stored in dist/
directory.
Development
To see Makefile targets documentation:
$ make help
Required tools for development:
# Check development tools setup
$ make setup-check
# Install development tools
$ make setup-dev
Project Structure
api/
Protocol buffer definitions, OpenAPI specs, and other information for external client.
build/
Packaging and Continuous Integration. Primarily Dockerfile(s).
cmd/
Applications entrypoint. main
package(s) should be defined here.
db/
SQL migrations, queries, entrypoint, etc.
internal/
Private application and library code.
TODO
Domain
- Authentication
- Auth token creation from credentials
- Admin passcode from command line argument
- Unit tests
- Exam
- Create new exam
- Get one exam by ID
- Get one exam by Password
- List all exams (with pagination)
- Update existing exam
- Delete existing exam
- Unit tests
- Question and Option
- Create new exam question with its options
- Get one question with its options by question ID
- List all questions with options for an exam (with pagination)
- Update existing question
- Delete existing question
- Unit tests
- Participant
- Create new exam participant
- Get one participant by ID
- List all participants for an exam (with pagination)
- List waiting participant in realtime (with pagination)
- Update existing participant
- Delete existing participant
- Unit tests
Data Persistence
- Auth SQLite
- Exam SQLite
- Question SQLite
- Option SQLite
- Participant SQLite
User Interface
- gRPC Server
- Authentication service server
- Exam service server
- Question service server
- Participant service server
Other
- JWT service wrapper package
- Release artifacts file server
- GitLab CI pipeline
License
testycool-server
is released under the Apache 2.0 license. See LICENSE for details.