Code Monkey home page Code Monkey logo

wildfly.org.sample-application's Introduction

getting-started

The getting-started project is a simple Jakarta EE application with a HTTP endpoint that is running in WildFly.

The src/main folder contains a simple 'Hello world' style Jakarta EE application using JAX-RS.

Building the application

To run the application, you use Maven:

mvn clean package

Maven will compile the application, provision a WildFly server The WildFly server is created in target/server with the application deployed in it.

Running the application

To run the application, run the commands:

cd target/server
./bin/standalone.sh

Once WildFly is running, the application can be accessed at http://localhost:8080/

Testing the application

To run integration tests to verify the application, you use Maven:

mvn clean package verify

Tests in src/test are run against the server in target/server.

Build Docker Image

$ podman build -t myapp:latest .

Run the Docker Image

podman run --rm -p 8080:8080 -p 9990:9990 --name=myapp myapp

Pushing to local Image Registry

Tag thr image:

podman tag myapp localhost:5000/myapp

Start a local registry:

podman run --rm -p 5000:5000 --name registry registry:latest
podman run --rm -p 5000:5000 --volume ~/.registry/storage:/var/lib/registry registry:latest
podman push localhost:5000/myapp --tls-verify=false

PostgreSQL

Start PostgreSQL:

podman run --rm --name my-postgres -p 5432:5432 -e POSTGRES_PASSWORD=admin -e POSTGRES_USER=postgres -e POSTGRES_DB=postgres postgres

Add some data to PostgreSQL:

podman exec -it my-postgres bash
psql -U postgres
CREATE TABLE TEST_TABLE (
  id SERIAL PRIMARY KEY,
  SOME_FIELD1 VARCHAR (50) NOT NULL,
  SOME_FIELD2 VARCHAR (50) NOT NULL
);
insert into test_table values (1, 'prova1', 'prova1');
insert into test_table values (2, 'prova2', 'prova2');
insert into test_table values (3, 'prova3', 'prova3');
commit;
select * from TEST_TABLE;
quit
exit
export POSTGRESQL_USER=postgres
export POSTGRESQL_PASSWORD=admin
export POSTGRESQL_HOST=localhost
export POSTGRESQL_PORT=5432
export POSTGRESQL_DATABASE=postgres
export POSTGRESQL_JNDI=java:jboss/datasources/PostgreSQLDS

mvn clean install

./target/server/bin/standalone.sh

curl -X POST http://localhost:8080/hello/test-table/insert/somedata1/somedata2

curl http://localhost:8080/hello/test-table/list
minikube config set rootless true
minikube start --driver=podman --container-runtime=cri-o

kubectl port-forward svc/postgres-external 5432:5432

wildfly.org.sample-application's People

Contributors

tommaso-borgato avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.