This is backend main repository for Software Engineering Project
- Clone this repository
git clone https://gitlab.com/omzet-oriented-programming/majapahit-service.git
- Installing all dependency
go install
- Create .env file using .env.example and fill the environment variable you need (database data, port, etc)
- Activate postgreSQL
- If you have docker-compose you can run:
docker-compose up -d
- note: The default user is postgres and the password is root. You must make sure the user and password is the same in the .env file with the docker-compose.yml file.
- If you don't have it, you can install it here or you can manually install PostgreSQL and set up the user and password and make sure they are the same as the .env file configuration
- If you have docker-compose you can run:
- Go to your postgreSQL console and create the database using this command
CREATE DATABASE <your_database_name>
- note: make sure the name of database is the same as the .env file configuration. Default name is majapahitdb
- If you are not installed
go-migrate-cli
yet. You need to install it first to do migrations. You can check it here. Then just run:ormake migrate-up [N]
make migrate-down [N]
- note : N is an optional argument to do how many migrations you want to. Leave it blank if you want to do all.
- Run the server
go run main.go
If you are using docker I have set up the pgAdmin as database client GUI, you can use it if you want to.
- Make sure you already run the docker-compose service, you can run:
docker-compose up -d
- Go to the pgAdmin URL, default URL will be
http://localhost:5050
- Create new server and fill some information
- Name :
<your-server-name>
- Host :
host.docker.internal
- Port :
5432
- Maintenance Database :
majapahitdb
- Username :
postgres
- Password :
root
- Name :
- Save
- Before development create new branch from master or staging.
or
git checkout master && git pull origin master
git checkout staging && git pull origin staging
- Create new branch using naming convention
PBI-<pbi_number>-OOP-<jira_ticket_id>-<name_of_your_feature>
. Examplegit checkout -b PBI-1-OOP-1-registration
- Start developing you feature with TDD
- Red phase use
[RED]
tag as prefix of your commitgit commit -m "[RED] create success test case for registration"
- Green phase use
[GREEN]
tag as prefix of your commitgit commit -m "[GREEN] create implementation for success registration"
- Refactor phase use
[REFACTOR]
tag as prefix of your commitgit commit -m "[REFACTOR] improve clean code for registration"
- Non related TDD phase will use
[CHORES]
tag as prefix of your commitgit commit -m "[CHORES] update readme"
- Red phase use
- Run all the pre-deployment step
- Format
make fmt
- Lint
make lint
- Test
make fmt
- Coverage
make fmt
- Format
- If all the step is passed, you can push your commit to remote
git push