Skip to content

Commit

Permalink
update to book references
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <[email protected]>
  • Loading branch information
otaviojava committed Dec 3, 2024
1 parent 9ac54d2 commit 04cc3bf
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ FROM container-registry.oracle.com/java/jdk-no-fee-term:21
WORKDIR /helidon

# Copy the binary built in the 1st stage
COPY --from=build /helidon/target/movies.jar ./
COPY --from=build /helidon/target/books.jar ./
COPY --from=build /helidon/target/libs ./libs

CMD ["java", "-jar", "movies.jar"]
CMD ["java", "-jar", "books.jar"]

EXPOSE 8080
2 changes: 1 addition & 1 deletion Dockerfile.jlink
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ RUN echo "done!"

FROM debian:stretch-slim
WORKDIR /helidon
COPY --from=build /helidon/target/movies-jri ./
COPY --from=build /helidon/target/books-jri ./
ENTRYPOINT ["/bin/bash", "/helidon/bin/start"]
EXPOSE 8080
4 changes: 2 additions & 2 deletions Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ FROM scratch
WORKDIR /helidon

# Copy the binary built in the 1st stage
COPY --from=build /helidon/target/movies .
COPY --from=build /helidon/target/books .

ENTRYPOINT ["./movies"]
ENTRYPOINT ["./books"]

EXPOSE 8080
22 changes: 11 additions & 11 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= movies
= Books
:toc: auto

Sample Helidon MP project that includes multiple REST operations. This project requires Oracle NoSQL for data storage, which can be run locally or online.
Expand Down Expand Up @@ -27,7 +27,7 @@ To build and run this project, use JDK 21.
[source,bash]
----
mvn package
java -jar target/movies.jar
java -jar target/books.jar
----

The application will start on `localhost` at port `8181`.
Expand Down Expand Up @@ -81,17 +81,17 @@ Below are examples of using `curl` to interact with the API.

[source,bash]
----
# Example: Fetch all movies
curl -X GET http://localhost:8181/movies
# Example: Fetch all books
curl -X GET http://localhost:8181/books
# Example: Add a new movie
curl -X POST -H "Content-Type: application/json" -d '{"title": "Inception", "genre": "SCIENCE_FICTION", "releaseYear": 2010, "director": "Christopher Nolan", "actors": ["Leonardo DiCaprio", "Joseph Gordon-Levitt"]}' http://localhost:8181/movies
curl -X POST -H "Content-Type: application/json" -d '{"title": "Inception", "genre": "SCIENCE_FICTION", "releaseYear": 2010, "director": "Christopher Nolan", "actors": ["Leonardo DiCaprio", "Joseph Gordon-Levitt"]}' http://localhost:8181/books
# Example: Update a movie
curl -X PUT -H "Content-Type: application/json" -d '{"title": "Inception", "genre": "SCIENCE_FICTION", "releaseYear": 2010, "director": "Christopher Nolan", "actors": ["Leonardo DiCaprio", "Joseph Gordon-Levitt"]}' http://localhost:8181/movies/{id}
curl -X PUT -H "Content-Type: application/json" -d '{"title": "Inception", "genre": "SCIENCE_FICTION", "releaseYear": 2010, "director": "Christopher Nolan", "actors": ["Leonardo DiCaprio", "Joseph Gordon-Levitt"]}' http://localhost:8181/books/{id}
# Example: Delete a movie
curl -X DELETE http://localhost:8181/movies/{id}
curl -X DELETE http://localhost:8181/books/{id}
----

== Building the Docker Image
Expand All @@ -100,7 +100,7 @@ To build a Docker image for the application:

[source,bash]
----
docker build -t movies .
docker build -t books .
----

== Running the Docker Image
Expand All @@ -109,7 +109,7 @@ To run the Docker image:

[source,bash]
----
docker run --rm -p 8181:8181 movies:latest
docker run --rm -p 8181:8181 books:latest
----

== Run the Application in Kubernetes
Expand All @@ -130,8 +130,8 @@ kubectl get pods # Verify connectivity to cluster
----
kubectl create -f app.yaml # Deploy application
kubectl get pods # Wait for quickstart pod to be RUNNING
kubectl get service movies # Get service info
kubectl port-forward service/movies 8181:8080 # Forward service port to 8181
kubectl get service books # Get service info
kubectl port-forward service/books 8181:8080 # Forward service port to 8181
----

You can now exercise the application as described above but use port `8181`.
Expand Down
16 changes: 8 additions & 8 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
kind: Service
apiVersion: v1
metadata:
name: movies
name: books
labels:
app: movies
app: books
spec:
type: ClusterIP
selector:
app: movies
app: books
ports:
- name: tcp
port: 8080
Expand All @@ -17,21 +17,21 @@ spec:
kind: Deployment
apiVersion: apps/v1
metadata:
name: movies
name: books
spec:
replicas: 1
selector:
matchLabels:
app: movies
app: books
template:
metadata:
labels:
app: movies
app: books
version: v1
spec:
containers:
- name: movies
image: movies
- name: books
image: books
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/microprofile-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ metrics.rest-request.enabled=false
app.greeting=Hello

#eclipse jnosql properties
jnosql.keyvalue.database=movies
jnosql.document.database=movies
jnosql.keyvalue.database=books
jnosql.document.database=books
jnosql.oracle.nosql.host=http://localhost:8080

0 comments on commit 04cc3bf

Please sign in to comment.