This repository holds the files for the OpenLMIS Fulfillment Independent Service.
git clone https://github.com/OpenLMIS/openlmis-fulfillment.git
.env to the root folder of the project, with the requiredcd openlmis-fulfillment
curl -o .env -L https://raw.githubusercontent.com/OpenLMIS/openlmis-ref-distro/master/settings-sample.env
docker-compose run --service-ports fulfillment.gradle build to build. After the build steps finish, you should see 'Build Successful'.gradle bootRun. Once it is running, you should seeaccess_token before you can use the service.http://localhost:8081/.access_token which you must save for use on requests tohttp://localhost:8080/?access_token=<yourAccessToken> to see the service name and version.docker-machine ip and then visit http://<yourDockerIPAddress>:8080/.http://localhost:8080/index.html?access_token=<yourAccessToken> to see the Swagger UI showing the API endpoints.http://localhost:8080/api/*?access_token=<yourAccessToken> to hitTo stop the service (when it is running with gradle bootRun) use Control-C.
To clean up unwanted Docker containers, see the Docker Cheat Sheet.
See the API Definition and Testing section in the Example Service README at
https://github.com/OpenLMIS/openlmis-example/blob/master/README.md#api.
See the Building & Testing section in the Service Template README at
https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#building.
See the Security section in the Example Service README at
https://github.com/OpenLMIS/openlmis-example/blob/master/README.md#security.
See the Developing with Docker section in the Service Template README at
https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#devdocker.
See the Development Environment section in the Service Template README at
https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#devenv.
See the Build Deployment Image section in the Service Template README at
https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#buildimage.
TODO
See the Docker's file details section in the Service Template README at
https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#dockerfiles.
See the Running complete application with nginx proxy section in the Service Template README at
https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#nginx.
See the Logging section in the Service Template README at
https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#logging.
See the Internationalization section in the Service Template README at
https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#internationalization.
See the Debugging section in the Service Template README at
https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#debugging.
You can use a standard data set for demonstration purposes. To do so, first follow the Quick Start
until step 3 is done: https://github.com/OpenLMIS/openlmis-fulfillment/blob/master/README.md#quickstart.
Then, before gradle bootRun, use gradle demoDataSeed. This will generate a sql input file under./demo-data directory.
To insert this data into the database, finish the Quick Start steps,
and then outside of container's interactive shell, run:docker exec -i openlmisfulfillment_db_1 psql -Upostgres open_lmis < demo-data/input.sql
By default when this service is started, it will clean its schema in the database before migrating
it. This is meant for use during the normal development cycle. For production data, this obviously
is not desired as it would remove all of the production data. To change the default clean & migrate
behavior to just be a migrate behavior (which is still desired for production use), we use a Spring
Profile named production. To use this profile, it must be marked as Active. The easiest way to
do so is to add to the .env file:
spring_profiles_active=production
This will set the similarly named environment variable and limit the profile in use. The
expected use-case for this is when this service is deployed through the
Reference Distribution.
A basic set of demo data is included with this service, defined under ./demo-data/. This data may
be optionally loaded by using the demo-data Spring Profile. Setting this profile may be done by
setting the spring.profiles.active environment variable.
When building locally from the development environment, you may run:
$ export spring_profiles_active=demo-data
$ gradle bootRun
To see how to set environment variables through Docker Compose, see the
Reference Distribution
Environment variables common to all services are listed here: https://github.com/OpenLMIS/openlmis-template-service/blob/master/README.md#environment-variables
If you are using the hauptmedia/proftpd Docker image for testing fulfillment (like we do in our reference distribution), you can use the following variables to set the username and password for that server:
Note: the fulfillment service does not use the variables above for setting up any connections - the configuration is kept in the database and managed through the appropriate endpoints.
SHIPMENT_POLLING_RATE_MILLISECONDS - Rate in milliseconds how often shipment service should check for files over FTP
, default 10000
/SFTP, ...
SHIPMENT_SHIPPED_BY_ID - OLMIS user to send shipment files as, default admin, a337ec45-31a0-4f2b-9b2e-a105c4b669bb
ALLOW_FTP_TRANSFER_ON_REQUISITION_TO_ORDER - whether order file should be send over FTP, default true
SEND_EMAIL_ON_REQUISITION_TO_ORDER - whether order file should be send over email, default true
ALLOW_EMPTY_SHIPMENT - whether empty shipment (and consequently empty Proof of Delivery) should be accepted by
validation, default false