generated from aura-ascend/template-service
project setup
- update README.md
- setup tls
- update gradle.properties with docker tls ports
- update application.yml
- disable tls in develop
- set docker values
- add default tls values
- add keystore.p12
- setup postgres
- update application.yml with defualt values
- add 000-initizalise.sql
- add postgres dependencies and config
- add docker compose development
- add actuator.http
- add http environment
- update name and readme for service
This commit is contained in:
18
README.md
18
README.md
@@ -1,12 +1,20 @@
|
||||
# {service}
|
||||
# Basic Banking
|
||||
|
||||
{description}
|
||||
This Monolith is pretend to be different services, it also Postgres 18rc1 to have access to UUIDv7.
|
||||
|
||||
## Properties For Deployment
|
||||
|
||||
| Name | Required | Information |
|
||||
|------------------------|:--------:|-------------------------|
|
||||
|-------------------------------|:--------:|-------------------------|
|
||||
| spring.profiles.active | ✔ | Spring Boot environment |
|
||||
| spring.r2dbc.url | ✔ | Postgres host url |
|
||||
| spring.r2dbc.username | ✓ | Postgres username |
|
||||
| spring.r2dbc.password | ✱ | Postgres password |
|
||||
| server.port | | HTTP port |
|
||||
| server.ssl.enabled | | HTTP Enable SSL |
|
||||
| server.ssl.key-store | ✗ | HTTP Keystore |
|
||||
| server.ssl.key-store-type | | HTTP Cert Type |
|
||||
| server.ssl.key-store-password | ✱ | HTTP Cert Pass |
|
||||
|
||||
*Required:*
|
||||
|
||||
@@ -14,6 +22,10 @@
|
||||
- *✗ mounted file.*
|
||||
- *✱ need to be stored as secret.*
|
||||
|
||||
## Development
|
||||
|
||||
Use `development-compose.yml` to set up needed external dependencies.
|
||||
|
||||
## Releasing Service
|
||||
|
||||
Run release pipeline from `master` branch.
|
||||
|
||||
@@ -12,14 +12,19 @@ dependencies {
|
||||
implementation(aa.kotlin.reflect)
|
||||
implementation(aa.kotlinx.coroutines)
|
||||
implementation(aa.springboot.starter.actuator)
|
||||
implementation(aa.springboot.starter.r2dbc)
|
||||
implementation(aa.springboot.starter.webflux)
|
||||
|
||||
runtimeOnly(aa.postgresql)
|
||||
runtimeOnly(aa.postgresql.r2dbc)
|
||||
|
||||
testImplementation(aa.kotlin.junit5)
|
||||
testImplementation(aa.kotlinx.coroutines.test)
|
||||
testImplementation(aa.mockk)
|
||||
testImplementation(aa.springboot.starter.test)
|
||||
|
||||
testRuntimeOnly(aa.junit.platform.launcher)
|
||||
}
|
||||
|
||||
group = "ltd.lulz"
|
||||
description = "service template"
|
||||
description = "service basic banking"
|
||||
|
||||
24
development-compose.yml
Normal file
24
development-compose.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
name: develop
|
||||
|
||||
networks:
|
||||
develop:
|
||||
name: develop
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
postgres:
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18rc1-alpine
|
||||
container_name: postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
ports:
|
||||
- 5432:5432
|
||||
networks:
|
||||
- develop
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
@@ -1,2 +1,5 @@
|
||||
version=0.1.0-SNAPSHOT
|
||||
catalog=0.1.0
|
||||
catalog=0.2.0-SNAPSHOT
|
||||
docker.port.expose=8443
|
||||
container.port.expose=8443
|
||||
container.port.host=8443
|
||||
|
||||
3
http/actuator.http
Normal file
3
http/actuator.http
Normal file
@@ -0,0 +1,3 @@
|
||||
### Actuator
|
||||
|
||||
GET {{url}}/actuator
|
||||
11
http/http-client.env.json
Normal file
11
http/http-client.env.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"develop": {
|
||||
"url": "http://localhost:8080"
|
||||
},
|
||||
"docker": {
|
||||
"url": "https://localhost:8443"
|
||||
},
|
||||
"kubernetes": {
|
||||
"url": "https://10.0.0.0"
|
||||
}
|
||||
}
|
||||
20
instructions.md
Normal file
20
instructions.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Senior Engineer Test
|
||||
|
||||
### **Develop a service that simulates basic banking operations in a programming language of your choice. This service will manage accounts, process deposits, withdrawals, and transfers between accounts.**
|
||||
|
||||
### The system should be designed reflecting real-world constraints of a bank.
|
||||
|
||||
## Requirements:
|
||||
|
||||
1. A class or set of functions that allow:
|
||||
* Account creation: Allow users to create an account with an initial deposit.
|
||||
* Deposit: Enable users to deposit money into their account.
|
||||
* Withdrawal: Allow users to withdraw money from their account, ensuring that overdrafts are not allowed.
|
||||
* Transfer: Enable transferring funds between accounts.
|
||||
* Account balance: Provide the ability to check the account balance.
|
||||
2. Database:
|
||||
* In-memory data storage will suffice, no need to have a database alongside the project, but you can add one at your discretion
|
||||
|
||||
The word “service” here is used in a “software component/module” rather “deployable unit with an API” sense, no need to provide API for it.
|
||||
|
||||
## Feel free to take as along as you need to complete the exercise. This will be used as a base for a follow-up pair programming session.
|
||||
@@ -34,4 +34,4 @@ pluginManagement.repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
rootProject.name = "service"
|
||||
rootProject.name = "basic-banking"
|
||||
|
||||
64
sql/initial/000-initizalise.sql
Normal file
64
sql/initial/000-initizalise.sql
Normal file
@@ -0,0 +1,64 @@
|
||||
-- Role: role_administrator
|
||||
-- DROP ROLE IF EXISTS role_administrator;
|
||||
|
||||
CREATE ROLE role_owner;
|
||||
|
||||
|
||||
-- Role: role_service
|
||||
-- DROP ROLE IF EXISTS role_service;
|
||||
|
||||
CREATE ROLE role_service;
|
||||
|
||||
|
||||
-- Role: role_maintainer
|
||||
-- DROP ROLE IF EXISTS role_maintainer;
|
||||
|
||||
CREATE ROLE role_maintainer;
|
||||
|
||||
|
||||
-- Role: support_role
|
||||
-- DROP ROLE IF EXISTS support_role;
|
||||
|
||||
CREATE ROLE role_support;
|
||||
|
||||
|
||||
-- User: services
|
||||
-- DROP USER IF EXISTS services;
|
||||
|
||||
CREATE USER service WITH PASSWORD 'password';
|
||||
|
||||
-- Assign role to the user
|
||||
GRANT role_service TO service;
|
||||
|
||||
|
||||
-- User: user_maintainer
|
||||
-- DROP USER IF EXISTS user_maintainer;
|
||||
|
||||
CREATE USER user_maintainer WITH PASSWORD 'password';
|
||||
|
||||
-- Assign role to the user
|
||||
GRANT role_maintainer TO user_maintainer;
|
||||
|
||||
|
||||
-- User: user_support
|
||||
-- DROP USER IF EXISTS user_support;
|
||||
|
||||
CREATE USER user_support WITH PASSWORD 'password';
|
||||
|
||||
-- Assign role to the user
|
||||
GRANT role_support TO user_support;
|
||||
|
||||
|
||||
-- Database: basic_banking
|
||||
-- DROP DATABASE IF EXISTS basic_banking;
|
||||
|
||||
CREATE DATABASE basic_banking
|
||||
WITH
|
||||
OWNER = role_owner
|
||||
ENCODING = 'UTF8'
|
||||
TABLESPACE = pg_default
|
||||
CONNECTION LIMIT = -1
|
||||
IS_TEMPLATE = False;
|
||||
|
||||
COMMENT ON DATABASE basic_banking
|
||||
IS 'Database for basic banking, registered account and transactions.';
|
||||
@@ -24,6 +24,13 @@ management:
|
||||
exposure:
|
||||
include: "health,info"
|
||||
|
||||
server:
|
||||
port: 8443
|
||||
ssl:
|
||||
enabled: true
|
||||
key-store: classpath:cert/keystore.p12
|
||||
key-store-type: PKCS12
|
||||
|
||||
---
|
||||
###########################
|
||||
### Develop environment ###
|
||||
@@ -32,6 +39,16 @@ spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: develop
|
||||
r2dbc:
|
||||
url: r2dbc:postgresql://localhost:5432/basic_banking
|
||||
username: service
|
||||
password: password
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
ssl:
|
||||
enabled: false
|
||||
# key-store-password: password
|
||||
|
||||
---
|
||||
##########################
|
||||
@@ -41,6 +58,14 @@ spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: docker
|
||||
r2dbc:
|
||||
url: r2dbc:postgresql://postgres:5432/basic_banking
|
||||
username: service
|
||||
password: password
|
||||
|
||||
server:
|
||||
ssl:
|
||||
key-store-password: password
|
||||
|
||||
---
|
||||
##############################
|
||||
@@ -50,3 +75,5 @@ spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: kubernetes
|
||||
r2dbc:
|
||||
url: r2dbc:postgresql://postgres:5432/basic_banking
|
||||
|
||||
BIN
src/main/resources/cert/keystore.p12
Normal file
BIN
src/main/resources/cert/keystore.p12
Normal file
Binary file not shown.
Reference in New Issue
Block a user