Skip to content

Latest commit

 

History

History
150 lines (118 loc) · 5.16 KB

File metadata and controls

150 lines (118 loc) · 5.16 KB

Hand's on

Repository organisation

Here is how this repository is organised and a short explanation:

    ├── authorization-server    -->OAUTH2 Spring Authorization Server
    ├── config-server           -->Spring Cloud Configuration Server
    ├── docs                    -->Workshop documentation
    ├── gateway                 -->Spring Cloud Gateway
    ├── gradle                  -->Gradle configuration files and wrapper binaries
    ├── infrastructure          -->Docker compose based infrastructure(database,prometheus,jaeger)
    ├── rest-book               -->Spring Boot Bookstore application
    └── rest-number             -->Spring Boot Number application

🏃 Warm up

💻 Infrastructure

⚠️ The required infrastructure is available by running Docker containers.

You can start the whole by running Docker compose.

cd infrastructure
docker compose up -d

If you start this command on Gitpod, you will be asked to make public or not some network ports.
You can make them public.

You can then check the running containers by running this command:

docker compose ps
NAME                      COMMAND                  SERVICE             STATUS              PORTS
books-database            "docker-entrypoint.s…"   database            running             0.0.0.0:5432->5432/tcp
books-monitoring          "/bin/prometheus --c…"   monitoring          running             0.0.0.0:9090->9090/tcp
infrastructure-jaeger-1   "/go/bin/all-in-one-…"   jaeger              running             5775/udp, 5778/tcp, 14250/tcp, 6832/udp, 14268/tcp, 0.0.0.0:6831->6831/udp, 0.0.0.0:16686->16686/tcp

💁 Spring services to be started before

⚠️ You MUST also start the config-server service before.

Start a new shell and run the following command at the root of the project (i.e., rest-apis-versioning-workshop)

./gradlew bootRun -p config-server

You should have the following output indicating the service is ready:

 [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8888 (http) with context path ''
 [  restartedMain] i.t.a.c.ConfigServerApplication          : Started ConfigServerApplication in 2.986 seconds (JVM running for 3.328)

⚠️ You can ignore the message below and start using the API

<==========---> 80% EXECUTING [13s]

To check it is effectively ready, you can reach the API by running this command:

http http://localhost:8888/rest-number/default 

You should have such an output:

Click to expand
HTTP/1.1 200 
Connection: keep-alive
Content-Type: application/json
Date: Mon, 07 Nov 2022 16:44:35 GMT
Keep-Alive: timeout=60
Transfer-Encoding: chunked

{
"label": null,
"name": "rest-number",
"profiles": [
"default"
],
"propertySources": [
{
"name": "classpath:/config/rest-number.yml",
"source": {
"management.auditevents.enabled": true,
"management.endpoint.health.enabled": true,
"management.endpoint.health.probes.enabled": true,
"management.endpoint.health.show-details": "always",
"management.endpoint.metrics.enabled": true,
"management.endpoint.prometheus.enabled": true,
"management.endpoint.shutdown.enabled": true,
"management.endpoints.enabled-by-default": true,
"management.endpoints.jmx.exposure.include": "*",
"management.endpoints.web.exposure.include": "*",
"management.health.livenessstate.enabled": true,
"management.health.readinessstate.enabled": true,
"management.metrics.web.client.request.autotime.enabled": true,
"opentracing.jaeger.enabled": true,
"opentracing.jaeger.udp-sender.host": "localhost",
"opentracing.jaeger.udp-sender.port": 6831,
"resilience4j.bulkhead.configs.default.maxConcurrentCalls": 100,
"resilience4j.bulkhead.instances.book-numbers.maxConcurrentCalls": 10,
"resilience4j.thread-pool-bulkhead.configs.default.coreThreadPoolSize": 2,
"resilience4j.thread-pool-bulkhead.configs.default.maxThreadPoolSize": 4,
"resilience4j.thread-pool-bulkhead.configs.default.queueCapacity": 2,
"resilience4j.thread-pool-bulkhead.instances.book-numbers.baseConfig": "default",
"resilience4j.timelimiter.configs.default.cancelRunningFuture": false,
"resilience4j.timelimiter.configs.default.timeoutDuration": "2s",
"resilience4j.timelimiter.instances.book-numbers.baseConfig": "default",
"server.port": 8081,
"spring.application.name": "rest-number",
"spring.cloud.circuitbreaker.resilience4j.enabled": true,
"time.to.sleep": 1000
}
}
],
"state": null,
"version": null
}

✨ Ready? Let's deep dive into versioning!

Here are the chapters covered by this workshop:

  1. Dealing with updates without versioning
  2. Our first version
  3. Adding new customers and a new functionalities
  4. Configuration management
  5. Dealing with conflicts
  6. Authorization issues