{"id":18429079,"url":"https://github.com/openliberty/sample-getting-started","last_synced_at":"2025-04-04T21:05:43.110Z","repository":{"id":30571300,"uuid":"123491281","full_name":"OpenLiberty/sample-getting-started","owner":"OpenLiberty","description":"Getting started sample","archived":false,"fork":false,"pushed_at":"2024-12-05T23:34:21.000Z","size":585,"stargazers_count":12,"open_issues_count":15,"forks_count":146,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T20:06:02.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://openliberty.io/start/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenLiberty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2018-03-01T20:54:52.000Z","updated_at":"2024-12-09T16:44:03.000Z","dependencies_parsed_at":"2024-09-17T18:12:43.106Z","dependency_job_id":"e20ba598-5086-4fbf-8109-e2b1b942925f","html_url":"https://github.com/OpenLiberty/sample-getting-started","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fsample-getting-started","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fsample-getting-started/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fsample-getting-started/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenLiberty%2Fsample-getting-started/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenLiberty","download_url":"https://codeload.github.com/OpenLiberty/sample-getting-started/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249524,"owners_count":20908212,"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":[],"created_at":"2024-11-06T05:15:44.013Z","updated_at":"2025-04-04T21:05:43.080Z","avatar_url":"https://github.com/OpenLiberty.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Open Liberty logo](https://github.com/OpenLiberty/logos/blob/main/combomark/png/OL_logo_green_on_white.png)\n\n# Open Liberty Getting Started sample\n\n## Overview\nThe sample application provides a simple example of how to get started with Open Liberty. It provides a REST API that retrieves the system properties in the JVM and a web based UI for viewing them. It also uses MicroProfile Config, MicroProfile Health and MicroProfile Metrics to demonstrate how to use these specifications in an application that maybe deployed to kubernetes.\n\n## Project structure\n\n- `src/main/java` - the Java code for the Project\n  - `io/openliberty/sample`\n    - `config`\n      - `ConfigResource.java` - A REST Resource that exposes MicroProfile Config via a /rest/config GET request\n      - `CustomConfigSource.java` - A MicroProfile Config ConfigSource that reads a json file.\n    - `system`\n      - `SystemConfig.java` - A CDI bean that will report if the application is in maintenance. This supports the config variable changing dynamically via an update to a json file.\n      - `SystemHealth.java` - A MicroProfile Health check that reports DOWN if the application is in maintenance and UP otherwise.\n      - `SystemResource.java` - A REST Resource that exposes the System properties via a /rest/properties GET request. Calls to this GET method have MicroProfile Timer and Count metrics applied.\n      - `SystemRuntime.java` - A REST Resource that exposes the version of the Open Liberty runtime via a /rest/runtime GET request.\n    - `SystemApplication.java` - The Jakarta RESTful Web Services Application class\n  - `liberty/config/server.xml` - The server configuration for the liberty runtime\n  - `META-INF` - Contains the metadata files for MicroProfile Config including how to load CustomConfigSource.java\n  - `webapp` - Contains the Web UI for the application.\n  - `test/java/it/io/openliberty/sample/health`\n    - `HealthIT.java` - Test cases for a sample application running on `localhost`\n    - `HealthUtilIT.java` - Utility methods for functional tests\n- `resources/CustomConfigSource.json` - Contains the data that is read by the MicroProfile Config ConfigSource.\n- `Dockerfile` - The Dockerfile for building the sample\n- `pom.xml` - The Maven POM file\n\n## Build and Run the Sample locally\n\nClone the project\n\n```\ngit clone https://github.com/OpenLiberty/sample-getting-started.git\n```\n\nthen build and run it using Liberty dev mode:\n\n```\nmvnw liberty:dev\n```\n\nif you just want to build it run:\n\n```\nmvnw package\n```\n\n## Build container image from Dockerfile and run locally\nTo build the container image from Dockerfile and run locally using docker:\n\n```\ndocker build --platform=linux/amd64 -t openliberty-gettingstarted:\u003cTAG\u003e .\ndocker images --filter reference=openliberty-gettingstarted\nsudo docker run --platform=linux/amd64 -t -i -p 127.0.0.1:9080:9080 openliberty-gettingstarted:\u003cTAG\u003e \n```\n\nTo build the container image from Dockerfile and run locally using podman:\n\n```\npodman build --platform=linux/amd64 -t openliberty-gettingstarted:\u003cTAG\u003e .\npodman images --filter reference=openliberty-gettingstarted\nsudo podman run --platform=linux/amd64 -t -i -p 127.0.0.1:9080:9080 openliberty-gettingstarted:\u003cTAG\u003e \n```\n\n### Access the application\nOpen a browser to http://localhost:9080\n\n## Run the Sample in a container\n\nTo run the sample using docker run:\n\n```\ndocker run -p 9080:9080 icr.io/appcafe/open-liberty/samples/getting-started\n```\n\nTo run the sample using podman run:\n\n```\npodman run -p 9080:9080 icr.io/appcafe/open-liberty/samples/getting-started\n```\n\n\n### Access the application\nOpen a browser to http://localhost:9080\n\n![image](https://user-images.githubusercontent.com/3076261/117993383-4f34c980-b305-11eb-94b5-fa7319bc2850.png)\n\n## Run the functional tests\n\nThe test cases uses [JUnit 5](https://junit.org/junit5/) and \n[Maven Failsafe Plugin](https://maven.apache.org/surefire/maven-failsafe-plugin/index.html) defined \nin [`pom.xml`](pom.xml).\n\n\u003e Note: Sample appplication must be running on `http://localhost` before running the test cases. \n\u003e \u003cbr\u003e\n\u003e See [`HealthUtilIT.java`](src/test/java/it/io/openliberty/sample/health/HealthUtilIT.java) to change \n\u003e the change the sample application target URL.\n\nTo run the test cases against a running sample application, use the following command\n```\nmvnw failsafe:integration-test\n```\n\nTo view the test results, look at the console output or look under \ndirectory  `target/failsafe-reports`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenliberty%2Fsample-getting-started","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenliberty%2Fsample-getting-started","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenliberty%2Fsample-getting-started/lists"}