Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hmcts/opal-external-api

Opal External API Service
https://github.com/hmcts/opal-external-api

jenkins-sds

Last synced: about 2 months ago
JSON representation

Opal External API Service

Awesome Lists containing this project

README

        

# opal-external-api

## Building and deploying the application

### Building the application

#### Environment Variables

The following environment variables are required to run the service.

```bash
OPAL_SOAP_JKS_STRING=/u3+7QAAAAIAAAACAAAAAgADY3BwAAABkVqWGE0ABVguNTA5AAADVDCCA1AwggI4oAMCAQICFFuw3TvZKoraJ5/9So7jAZFalFXYMA0GCSqGSIb3DQEBCwUAMGExCzAJBgNVBAYTAnVrMRcwFQYDVQQIDA5ncmVhdGVyIGxvbmRvbjEPMA0GA1UEBwwGbG9uZG9uMQwwCgYDVQQKDANnb3YxDDAKBgNVBAsMA2NwcDEMMAoGA1UEAwwDY3BwMCAXDTI0MDgxNjA5NDU1NloYDzIxMjQwODE2MDk0NTU2WjBhMQswCQYDVQQGEwJ1azEXMBUGA1UECAwOZ3JlYXRlciBsb25kb24xDzANBgNVBAcMBmxvbmRvbjEMMAoGA1UECgwDZ292MQwwCgYDVQQLDANjcHAxDDAKBgNVBAMMA2NwcDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJporX4EOXHA2EJsaKO4UBgdidt8oaSIYu0NrGs+KYxMhQkHI6XfT9A8K4YUgC+LBxrr6VEJPkNP2zglLIUOETiI3AVoYu3hGoCGhfEOHt61lCmIItAYtFMQDzBNGUN652gZucIIVVY19Uz1JAqsTYmDL7etFEOMaXQ8L3Y8LTZbxBhsbNaDhUwxHMM7Uz7zTs4tD7Lq0LlflkxexLv1X7GXu71dPlxLh6/z6ccVbqsl7UNfKc+8k8k+JQ0DRXxEyT9QWc8c1Y/iR57yvJeyWg0jLlY+UbHUJxuv0KPusdHSLsq9mD0JMDQwePIZRAISHPvLuCwizXEccZ9ixwxCcRkCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAE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AKQDFVI
OPAL_SOAP_JKS_PASSWORD=password
```
The project uses [Gradle](https://gradle.org) as a build tool. It already contains
`./gradlew` wrapper script, so there's no need to install gradle.

To build the project execute the following command:

```bash
./gradlew build
```

### Running the application

Create the image of the application by executing the following command:

```bash
./gradlew assemble
```

Create docker image:

```bash
docker-compose build
```

Run the distribution (created in `build/install/opal-external-api` directory)
by executing the following command:

```bash
docker-compose up
```

This will start the API container exposing the application's port
(set to `4551` in this template app).

In order to test if the application is up, you can call its health endpoint:

```bash
curl http://localhost:4551/health
```

You should get a response similar to this:

```
{"status":"UP","diskSpace":{"status":"UP","total":249644974080,"free":137188298752,"threshold":10485760}}
```

### Alternative script to run application

To skip all the setting up and building, just execute the following command:

```bash
./bin/run-in-docker.sh
```

For more information:

```bash
./bin/run-in-docker.sh -h
```

Script includes bare minimum environment variables necessary to start api instance. Whenever any variable is changed or any other script regarding docker image/container build, the suggested way to ensure all is cleaned up properly is by this command:

```bash
docker-compose rm
```

It clears stopped containers correctly. Might consider removing clutter of images too, especially the ones fiddled with:

```bash
docker images

docker image rm
```

There is no need to remove postgres and java or similar core images.

## Testing
All testing of the SOAP interfaces can be done via opensource tool SoapUI (https://www.soapui.org/downloads/soapui/).
A pre-prepared SoapUI project is available in the /soapui directory. Import this project into SoapUI and run the tests.

### CPP Services
For CPP services SoapUI will need to be provided a test jks file. This can be found in the /soapui/testKeystore directory.
Within SoapUI, navigate to the CPP-OPAL project and update the WS-Security Configurations > Keystore settings to point to the provided jks file. (remove any existing keystore configurations)
The password for the jks file is 'password'.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details