Component | Code report |
---|---|
Admin Api | |
Auth Api Init | |
Auth Api | |
Publisher Init | |
Publisher | |
Consumer | |
Public Api |
Library | Code report |
---|---|
Env | |
JWT | |
MariaDB | |
MongoDB | |
Postgres | |
RabbitMQ | |
Redis |
- Golang 1.20.3
- Docker 20.10.25
- Docker-compose 1.29.2
DB_HOST
- PostgreSQL host (default:localhost
)DB_PORT
- PostgreSQL port (default:5432
)DB_USER
- PostgreSQL user (default:adventcalendar
)DB_PASSWORD
- PostgreSQL password (default:adventcalendar
)DB_NAME
- PostgreSQL database name (default:adventcalendar
)DB_SSL_MODE
- PostgreSQL ssl mode (default:disable
)ADMIN_USERNAME
- Admin username (default:admin
)ADMIN_EMAIL
- Admin email (default:[email protected]
)ADMIN_PASSWORD
- Admin password (default:admin
)
Admin-api Init environment variables are required
SECRET_KEY
- Secret key for JWT token (default:secret
)PORT
- Api port (default:8080
)METRICS_PORT
- Api metrics port (default:8081
)REDIS_HOST
- Redis host (default:localhost
)REDIS_PORT
- Redis port (default:6379
)REDIS_PASSWORD
- Redis password (default:""
)REDIS_DB
- Redis database (default:0
)
DB_HOST
- MariaDB host (default:localhost
)DB_PORT
- MariaDB port (default:3306
)DB_USER
- MariaDB user (default:adventcalendar
)DB_PASSWORD
- MariaDB password (default:adventcalendar
)DB_NAME
- MariaDB database name (default:adventcalendar
)
Email-api Publisher Init environment variables are required
PORT
- Api port (default:8080
)METRICS_PORT
- Api metrics port (default:8081
)RABBITMQ_HOST
- Rabbitmq host (default:localhost
)RABBITMQ_PORT
- Rabbitmq port (default:5672
)RABBITMQ_USER
- Rabbitmq user (default:guest
)RABBITMQ_PASSWORD
- Rabbitmq password (default:guest
)RABBITMQ_VHOST
- Rabbitmq vhost (default:/
)
RABBITMQ_HOST
- Rabbitmq host (default:localhost
)RABBITMQ_PORT
- Rabbitmq port (default:5672
)RABBITMQ_USER
- Rabbitmq user (default:guest
)RABBITMQ_PASSWORD
- Rabbitmq password (default:guest
)RABBITMQ_VHOST
- Rabbitmq vhost (default:/
)SMTP_AUTH
- SMTP auth (default:false
)SMTP_HOST
- SMTP host (default:localhost
)SMTP_PORT
- SMTP port (default:25
)SMTP_USER
- SMTP user (default:""
)SMTP_PASSWORD
- SMTP password (default:""
)SMTP_FROM
- SMTP from (default:""
)
Everything is in Makefile
In admin-api-init and admin-api directory
make run
- Run applicationmake test
- Run testsmake tidy
- Update go.mod and go.summake build
- Build application binary
In root directory
make build-images
- Build docker images
make compose-up-dev
- Run docker-compose and create dev services (PostgreSQL, Redis, Rabbitmq, Prometheus, Grafana)make compose-down-dev
- Stop docker-compose and remove dev services (PostgreSQL, Redis, Rabbitmq, Prometheus, Grafana)make compose-ps-dev
- Show docker-compose dev processes (PostgreSQL, Redis, Rabbitmq, Prometheus, Grafana)
make compose-up-stage
- Run docker-compose and create stage services (PostgreSQL, Redis, Rabbitmq, Prometheus, Grafana, Adventcalendat-backend-init, Adventcalendar-backend)make compose-down-stage
- Stop docker-compose and remove stage services (PostgreSQL, Redis, Rabbitmq, Prometheus, Grafana, Adventcalendat-backend-init, Adventcalendar-backend)make compose-ps-stage
- Show docker-compose stage processes (PostgreSQL, Redis, Rabbitmq, Prometheus, Grafana, Adventcalendat-backend-init, Adventcalendar-backend)
make compose-up-dev
Before run application, you need to initialize database and create admin user.
cd admin-api-init && make run
cd admin-api && make run
http://localhost:8080
- Applicationhttp://localhost:8081
- Prometheus metrics
TODO: Swagger documentation
GET /api/ping
- Health check
GET /metrics
- Prometheus metrics
POST /api/auth/login
- User login
- Payload (example):
{"username": "testuser1", "password": "testpassword1"}
POST /api/auth/logout
- User logout
TODO: Swagger documentation
GET /api/ping
- Health check
GET /metrics
- Prometheus metrics
Authentication is required for all endpoints below.
Based on JWT(Json Web Token) authentication. Before using private endpoints, you need to get JWT token from /api/auth/login
endpoint.
GET /api/admin/usermanage/user
- Get user
- Payload (example):
{"username": "testuser1"}
POST /api/admin/usermanage/user
- Create user
- Payload (example):
{"username": "testuser1", "email": "[email protected]", "password": "testpassword1"}
PUT /api/admin/usermanage/user
- Update user
- Payload (example):
{"username": "testuser1", "email": "[email protected]", "password": "testpassword1"}
DELETE /api/admin/usermanage/user
- Delete user
- Payload (example):
{"username": "testuser1"}
GET /api/admin/usermanage/users
- Get all users
TODO: Swagger documentation
GET /api/ping
- Health check
GET /metrics
- Prometheus metrics
Authentication is required for all endpoints below.
Based on JWT(Json Web Token) authentication. Before using private endpoints, you need to get JWT token from /api/auth/login
endpoint.
GET /api/admin/emailmanage/email
- Get all email patterns
POST /api/admin/emailmanage/customemail
- Create custom email, which is template for email and automatically send to RabbitMQ
- Payload (example):
{"emailto": "[email protected]", "subject": "Test subject", "body": "Test body"}
POST /api/admin/emailmanage/sendemail
- Send email to RabbitMQ, which is stored in database
- Payload (example):
{"name": "customemailpattern"}
POST /api/admin/emailmanage/email
- Create email pattern, which is stored in database
- Payload (example):
{"name": "name": "customemailpattern", "from": "instace1@localhost", "to": "weblist@localhost", "subject": "Test subject", "body": "Test body"}
PUT /api/admin/emailmanage/email
- Update email pattern
DELETE /api/admin/emailmanage/email
- Delete email
- Payload (example):
{"name": customname}