* INFRA-809 | Ashvin | Replace jsonnet with kutegen * INFRA-809 | Ashvin | Install kutegen on build and test * INFRA-809 | Ashvin | Fix 'static' modifier out of order with the JLS suggestions in KutegenClient.java * INFRA-809 | Ashvin | Remove all templates files * INFRA-809 | Ashvin | Add kutegen submodule * INFRA-809 | Ashvin | Use go run kutegen instead of build This will save dev an extra step of building kutegen each time they make a change in the templates files and thus save time and effort. go.work file lets us run go build and run in the parent directory. * INFRA-809 | Ashvin | Remove redundant dirs from Dockerfile * INFRA-809 | Ashvin | Remove go build in maven file. This was causing various dependency issue in the build process. I will add a Makefile if there is a need in the future for now. For now all local development will be done using go run command so this will not be necessary. * INFRA-809 | Ashvin | Update kutegen version * INFRA-809 | Ashvin | Revert YAML support from kutegen * INFRA-809 | Ashvin | Rebase the commit to kutegen * INFRA-809 | Ashvin | Fix test Using changes in the kutegen * INFRA-809 | Ashvin | Remove the templates dir * INFRA-809 | Ashvin | Clean generated dirs with mvn clean
47 lines
1.8 KiB
Markdown
47 lines
1.8 KiB
Markdown
# Deployment Portal Backend
|
|
- Run `git submodule update --init --recursive` to pull the kutegen submodule.
|
|
- Use `export ENVIRONMENT=test` to avoid applying changes to the cluster.
|
|
- Docker Setup
|
|
- To run the application just do `docker-compose up`
|
|
- It is assumed that `deployment-portal-frontend` repository is present in parallel to this folder.
|
|
|
|
## Initial Setup
|
|
- Create your user in the database
|
|
```sql
|
|
INSERT INTO users (created_at, updated_at, email, name)
|
|
VALUES (now(), now(), 'ashvin.s@navi.com', 'Ashvin S');
|
|
|
|
INSERT INTO users_roles(user_id, role_id)
|
|
(SELECT u.id, r.id
|
|
from users u,
|
|
role r
|
|
where u.email like 'ashvin.s@navi.com'
|
|
AND r.name IN ('PORTAL_MANAGER', 'Infra_ALL_MANAGER'));
|
|
|
|
INSERT INTO users_teams(user_id, team_id)
|
|
(SELECT u.id, t.id
|
|
from users u,
|
|
team t
|
|
where u.email like 'ashvin.s@navi.com'
|
|
AND t.name IN ('Infra'));
|
|
```
|
|
|
|
- This creates token for GOCD user
|
|
```sql
|
|
-- insert in tokens table id, created_at, updated_at, token, user_id
|
|
-- token should be bcrypt of a string
|
|
-- user_id should be user_id for gocd@ci.com
|
|
-- token is token
|
|
INSERT INTO tokens (created_at, updated_at, token, user_id)
|
|
VALUES (now(), now(), '$2a$12$LWmbUqPYFPqessz7z9OpvO6k0g/QEp6mBQxXMtIGkqPu4ih9exmbC', 1);
|
|
```
|
|
- To replicate roles and privileges from [user-mapping file on github](https://github.com/navi-infra/user-management/blob/master/deployment-portal/user-mapping.yaml)
|
|
```shell
|
|
curl -X POST "http://127.0.0.1:8080/api/user/mapping" \
|
|
-H "X_AUTH_TOKEN: token" \
|
|
-H "Content-Type: multipart/form-data; boundary=boundaryValue" \
|
|
-F "file=@<path-to-user-mapping-file>;filename=user-mapping.yml;type=application/x-yaml"
|
|
```
|
|
|
|
- For SonarQube Analysis of the project please refer: https://sonarqube.cmd.navi-tech.in/dashboard?id=Deployment-portal
|