{"id":18646462,"url":"https://github.com/ammbra/tictactoe","last_synced_at":"2025-11-05T05:30:22.643Z","repository":{"id":226676555,"uuid":"769348222","full_name":"ammbra/tictactoe","owner":"ammbra","description":"Simple SSL enabled tictactoe game with SpringBoot, deployed with docker/podman compose. The game is used to observe JFR events in Prometheus.","archived":false,"fork":false,"pushed_at":"2024-09-30T10:08:38.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-18T04:31:10.047Z","etag":null,"topics":["jdk23","jfr","ssl","tls"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"upl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ammbra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-08T21:29:52.000Z","updated_at":"2024-09-30T10:08:42.000Z","dependencies_parsed_at":"2024-03-25T19:03:04.386Z","dependency_job_id":"1bd7b4a8-6042-4aa1-aa64-150b2a79d41c","html_url":"https://github.com/ammbra/tictactoe","commit_stats":null,"previous_names":["ammbra/tictactoe"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ammbra%2Ftictactoe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ammbra%2Ftictactoe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ammbra%2Ftictactoe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ammbra%2Ftictactoe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ammbra","download_url":"https://codeload.github.com/ammbra/tictactoe/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239449594,"owners_count":19640535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jdk23","jfr","ssl","tls"],"created_at":"2024-11-07T06:20:00.681Z","updated_at":"2025-11-05T05:30:22.595Z","avatar_url":"https://github.com/ammbra.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TicTacToe \n\nA sample web app to play Tic Tac Toe against the computer. The application requires minimum JDK 21 to run locally.\n\n## Technologies\n\nThis application has several components:\n\n* Running on JDK 21+ and built with Maven.\n* Setup built with Spring Boot (v3.2.2), persistency layer with JPA and H2 database, UI with Thymeleaf with Bootstrap\n* Containerized with Dockerfile and deployed with Docker Compose.\n\n|           UI Component      |                   Link                             |\n|-----------------------------|----------------------------------------------------|\n| Header                      | https://getbootstrap.com/docs/5.3/examples/headers/|\n| Footer                      | https://getbootstrap.com/docs/5.3/examples/footers/|\n| Sign In and Register        | https://getbootstrap.com/docs/5.3/examples/sign-in/|\n\n## How to create the keystore and truststore\n\nIn order to build an example keystore, you can use the following series of commands:\n\n1. Create a CA certificate, by running `openssl req -x509 -sha256 -days 3650 -newkey rsa:4096 -keyout localCA.key -out localCA.crt`\n2. Create a certificate signing request, by running `openssl req -new -newkey rsa:4096 -keyout localhost.key -out localhost.csr`\n3. Make an extension file (`local.ext`) containing additional hosts and IPs that your certificate should authorize:\n\n```txt{local.ext}\nauthorityKeyIdentifier=keyid,issuer\nbasicConstraints=CA:FALSE\nsubjectAltName = @alt_names\n[alt_names]\nDNS.1 = localhost\nDNS.2 = springboot\nIP.1 = 127.0.0.1\n```\n\n4. Sign the request with our localCA.crt certificate and its private key:\n```shell\nopenssl x509 -req -CA localCA.crt -CAkey localCA.key -in localhost.csr \\\n    -out localhost.crt -days 365 -CAcreateserial -extfile local.ext\n```\n\n5. Create the keystore by importing the certificate created at previous step:\n```shell\nopenssl pkcs12 -export -out keystore.p12 -name \"localhost\" -inkey localhost.key -in localhost.crt\n```\n\nTo enable mutual authentication, you need to generate a truststore and generate client certificates:\n\n1. Create a truststore by running:\n\n```shell\nkeytool -import -trustcacerts -noprompt -alias ca -ext san=dns:localhost,ip:127.0.0.1 -file localCA.crt -keystore truststore.p12\n```\n\n2. Generate a client-side certificate signing request with common name (CN) Ana:\n\n```shell\nopenssl req -new -newkey rsa:4096 -nodes -keyout ana.key -out ana.csr -subj '/CN=ana'\n```\n\n3. Sign the request with the existing CA:\n\n```shell\nopenssl x509 -req -CA localCA.crt -CAkey localCA.key -in ana.csr -out ana.crt -days 365 -CAcreateserial\n```\n\n4. Package the signed certificate and the private key into the PKCS file:\n\n```shell\nopenssl pkcs12 -export -out ana.p12 -name \"ana\" -inkey ana.key -in ana.crt\n```\n\n5. Import the generated certificate (`ana.p12`) in your browser.\n\nDo not forget to reference the location of your keystore/truststore in the `application.properties` file:\n\n```text\nserver.ssl.bundle=mybundle\nspring.ssl.bundle.jks.mybundle.keystore.location=stores/keystore.p12\nspring.ssl.bundle.jks.mybundle.truststore.location=stores/truststore.p12\n```\n\n**IMPORTANT** For demo purposes, `application.properties` contains the passwords in clear. \nFor production environments you must consider encrypting your passwords.\n\n## How to play\n\nYou can start the application locally\nfrom your IDE or by running the following command in a terminal window:\n\n```\n./mvnw spring-boot:run\n```\n\nWhen accessing the application on https://localhost:8443, you will be asked to sign in to play. If you didn't register, \nyou can do so by clicking [the register link](https://localhost:8443/register). \nIf there is an user already registered with a chosen username, please select a different one.\n\nOnce you register, login with your chosen username and password to play. Have fun!\n\n## How to deploy\n\nYou can deploy the application locally via Docker Compose. First build the application using:\n\n```\n./mvnw clean verify\n```\n\nBy default, the provided docker compose file has enabled remote JMX connection via `JDK_JAVA_OPTIONS` environment variable:\n\n```shell\n        -Dcom.sun.management.jmxremote.ssl=false\n        -Dcom.sun.management.jmxremote.authenticate=true\n        -Dcom.sun.management.jmxremote.rmi.port=1099\n        -Dcom.sun.management.jmxremote.port=1099\n        -Dcom.sun.management.jmxremote=true\n        -Dcom.sun.management.jmxremote.access.file=/etc/jmxremote/jmxremote.access\n        -Dcom.sun.management.jmxremote.password.file=/etc/jmxremote/jmxremote.password\n```\n\nand mounts the `jmxremote.access` and `jmxremote.password` files as volumes from stores folder:\n\n```yaml\n    volumes:\n      - ./stores/jmxremote.access:/etc/jmxremote/jmxremote.access\n      - ./stores/jmxremote.password:/etc/jmxremote/jmxremote.password\n```\n\nIf you wish to keep that configuration, make sure that you can read and write the `/etc/jmxremote/jmxremote.password` and other users have no access to it.\nAn example on how to do that on Mac/Linux is by running the following command over :\n\n```shell\nchmod 0600 stores/jmxremote.password \n```\n\nNow you can invoke `docker-compose up` command:\n\n```\ndocker-compose up --build\n```\n\nThis will build a local containerize environment for you to inspect the application.\n\nIf you wish to deploy in other environments, you can always build and push a docker image using:\n\n```\ndocker buildx build --platform=linux/amd64  --tag \u003cregistry\u003e/\u003cusername\u003e/tictactoe:1.0 . --no-cache\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fammbra%2Ftictactoe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fammbra%2Ftictactoe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fammbra%2Ftictactoe/lists"}