# Packages
# README
Attendance Management System
Table of Contents
- About the project
- Prerequisites
- Getting started
- Run the project
- Access the project logs
- Configure Database through PgAdmin
- Entry Point
- Possible Issues
- Shutting down the application
About the project
A School Attendance Management System where there are three entities Principal, Teacher and Students where all of them will have different functionalities.
API docs
All the API endpoints can be found in the Postman Import Link
Prerequisites
This project uses Docker
for containerization and requires Docker to be installed in your system. Refer the following if you don't have Docker yet.
Linux
Run this quick and easy install script provided by Docker:
curl -sSL https://get.docker.com/ | sh
If you're not willing to run a random shell script, please see the installation instructions for your distribution.
macOS
Download and install Docker Community Edition. if you have Homebrew-Cask, just type brew install --cask docker
. Or Download and install Docker Toolbox. Docker For Mac is nice, but it's not quite as finished as the VirtualBox install. See the comparison.
NOTE Docker Toolbox is legacy. You should to use Docker Community Edition, See Docker Toolbox.
Windows
Instructions to install Docker Desktop for Windows can be found here
Once installed, open powershell as administrator and run:
# Display the version of docker installed:
docker version
Getting started
Below we describe the conventions or tools specific to golang project.
Layout
├── .github
├── api
│ ├── controllers
│ │ └── attendance.controller.go
│ │ └── attendance.teacher.controller.go
│ │ └── db.go
│ │ └── home.controller.go
│ │ └── routes.go
│ │ └── teacher.controller.go
│ │ └── user.controller.go
│ ├── middlewares
│ │ └── middlewares.go
│ ├── models
│ │ └── attendance.go
│ │ └── attendance.teacher.go
│ │ └── teacher.go
│ │ └── user.go
│ ├── responses
│ │ └── json.go
│ ├── seeds
│ │ └── seeder.go
│ └── utils
│ └── formaterror
│ └── formaterror.go
├── .env
├── .gitignore
├── docker-compose.yml
├── Dockerfile
├── example.env
├── go.sum
├── go.mod
├── main.go
└-─ README.md
A brief description of the layout:
api
places most of project business logic and locatecontrollers
package - route handlers and controllersmiddlewares
package - middleware configurationsmodels
package - db models and methodsresponses
package - Json handlersseed
package - db migrations and model associationutils
package - error formater
.gitignore
varies per project, but all projects need to ignore.env
file.example.env
dummy structure of env variablesdocker-compose.yml
docker services and their configurationsDockerfile
project image instructionsmain.go
project entry-point.README.md
is a detailed description of the project.
Run the project
docker-compose up -d
Access the project logs
docker logs full_app
Configure Database through PgAdmin
Go to your browser and open:
http://localhost:5050
- Login by the credentials used in the environment veriables at
.env
file. - Choose and create a server with
HOST
,PORT
,USERNAME
andPASSWORD
as per the environment values only.
Entry Point
Now the application has successfully started. All the project API end-points are running and open at:
http://localhost:8080
Possible Issues
-
Issue with environmental variable: Maybe you used invalid details in the .env file, this might break your build. Carefully read the logs when you run docker-compose up. If you identify any and fix, terminate the process using
Ctrl+C
.-
Stop running process using :
docker-compose down --remove-orphans --volumes
-
Then to build again, use :
docker-compose up --build Observe the --build.
-
-
Any other issue: If you have any other issue, try and read the logs and fix them. then follow the exact same process to build again.
Shutting down the application
After successful testing of the application, you can shut it down using:
docker-compose down
Or to also remove the volumes too:
docker-compose down --remove-orphans --volumes
If you want to remove all dangling images, run:
docker system prune
To remove all unused images, not just dangling ones, run:
docker system prune -a
To remove all unused images not just dangling ones and volumes, run:
docker system prune -a --volumes