Customer Management API Flashcards

1
Q

What is the lib directory?

A

deprecated external libs code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the src directory?

A

deprecated domain logic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How many different processes are run inside the application container? What are their purposes?

A

supervisor: the process manager
consul: to get environment vars
nginx: web server process
php-fpm: manager of php in multi processes
vault-lease-updater: secrets management

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What Cassandra is used for?

A

Cassandra is a NoSql database management from Apache. Is used in the FavouriteRestaurantRepository now and it stores its related data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What PHP and Laravel version are?

A

PHP 7.3, Laravel 6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How many endpoints exist in the API?

A

11 api endpoints:

POST /api/v1/authentication/country/{country}
GET /api/v1/authentication/iv-verify
GET /api/v1/authentication/email
POST /api/v1/authentication/social-login/apple
POST /api/v1/authentication/social-login/google
GET /api/v1/customer/checkout-info
GET /api/v1/customer/{customerId}
GET /api/v1/customer/{customerId}/favourite/restaurants
POST /api/v1/customer/{customerId}/favourite/restaurants
POST /api/v1/customer/{customerId}/favourite/restaurant/{restaurantId}
DELETE /api/v1/customer/{customerId}/favourite/restaurant/{restaurantId}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What authentication methods are available for the different endpoints?

A

JWT, IV, Email, Social Login

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Call any endpoint. Look at the logs. What log messages are always present? How does it work? What is requestId in log messages?

A

There are 3 logs that are always present. An application log informing the request data, an nginx log, then a response log informing the resulted response.
The requestId is used to let log auditing quickly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What test suites are available? How to run all the tests? How to run one single test?

A

There are 3 testsuites Functional, Integration, Unit.

You run all the tests running the command ‘phpunit’.

You run only one test running the command with ‘phpunit –filter methodName ClassName path/to/file.php’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Where is the Dockerfile for the service? What stages are defined there? Describe shortly them all.

A

The Dockerfile is in the docker/app folder

There are five stages on it:

A stage to install SO libraries and packages and its configurations
A stage to install composer packages
A stage to build the production image
A stage to run the code coverage
A stage to build the development image
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is used as a base docker image for the service?

A

docker.takeaway.com/service:latest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What stages available in the Gitlab pipeline for the project? Describe shortly them all.

A

prepare: build base image and push to registry
build: build feature and staging image and push to registry
review: deploy in marathon to review
test: run tests and coverage
syntax: run sonarqube

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is feature-branch deployment?

A

Is when the development on the source code is made in separated/encapsulated branches. Only merge to master when is ready for production

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Describe the process of how the configuration is being injected in the service at the bootstrap moment.

A

When the consul container is bootstrapping the /consul/sbin/consul-setup.sh file is executed. This command starts the consul client agent and stores the data from the /consul/seed directory through HTTP requests

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happened when the configuration has been changed in Vault or Consul K/V? How is it being injected without service shut down?

A

As soon as the configuration has changed the process called ‘vault-lease-updater’ will update the vars accordingly. Since there is a command to “re-cache” the cache in the vault.template there is no need to restart the application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What Consul K/V paths are used by Customer Management API?

A

payment-api/takeawaypay/payment-settings
takeaway/country-info
customer-management/site-settings
customer-management/google-sign-in-client-ids.

17
Q

How to know all the paths that are used by a service?

A

You can know the paths used seeing the environment variables used in the vault.template file.

18
Q

What Vault paths are used by Customer Management API?

A

/database/creds/customer-management-api-rw
/database/creds/customer-management-api-ro
/secret/customer-management-api/jwt-secret-asymmetrical
/secret/customer-management-api/auth-users
/secret/customer-management-api/cassandra

19
Q

What configuration is injected from Vault in Customer Management API?

A

Credentials like to the users that will use basic-auth and the DB credentials

20
Q

How database grants are applied and managed by local Vault?

A

They are applied by the sql script in the file thuis-ro and thuis-rw as configured when enabling the database engine in vault. Then the process lease-update.rd renew the credentials for the database.

21
Q

Which are the tables used?

A

….

22
Q

Why are the use for the consul paths?

A

23
Q

Which are the domain logic for the endpoints?

A