Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needed a quick way to init the server #461

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion tools/misbehaving-jmx-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ WORKDIR /app

# Copy the JAR file from the Maven image to the final image
COPY --from=build /app/target/misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar .
COPY scripts/startup.sh scripts/init.sh /app/
# Default ports
EXPOSE 1099
EXPOSE 8080
EXPOSE 8088

# Used for testcontainers
EXPOSE 9090
EXPOSE 9091
EXPOSE 9092

# Run the supervisor class from the jar
CMD ["java", "-cp", "misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar", "org.datadog.supervisor.App"]
#CMD ["java", "cp", "misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar", "org.datadog.supervisor.App"]
CMD ["/app/startup.sh"]
16 changes: 16 additions & 0 deletions tools/misbehaving-jmx-server/scripts/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# Wait for port 8088 to be available
until curl -s -o /dev/null localhost:8088
do
sleep 5
done

# Make a curl request
curl http://localhost:8080/your-api-endpoint
# http POST localhost:8088/init rmiHostname=192.168.160.3
IP_ADDRESS=`awk 'END{print $1}' /etc/hosts`
echo "Host is ${IP_ADDRESS}"
curl --silent --show-error -o /dev/null -X POST -H 'Content-Type: application/json' -d "{\"rmiHostname\":\"${IP_ADDRESS}\"}" localhost:8088/init

# http POST localhost:8080/beans/Bohnanza numDesiredBeans=5
5 changes: 5 additions & 0 deletions tools/misbehaving-jmx-server/scripts/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

nohup ./init.sh &

java -cp misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar "org.datadog.supervisor.App"