Copyright (C) 2017 The Open Library Foundation
This software is distributed under the terms of the Apache License, Version 2.0. See the file "LICENSE" for more information.
Mod-Elf is an Okapi module that provides the webservices for a electronic loanable form.
In order for mod-elf to send e-mails, you will need to configure smtp settings.
- Open EmailComposer.java
code ~/Desktop/folio/bl/mod-elf/src/main/java/org/folio/rest/utils/EmailComposer.java
- Provide your smtp username, password, host, and port.
private final String SMTP_USERNAME = "username"; private final String SMTP_PASSWORD = "password"; private final String SMTP_HOST = "smtp.gmail.com"; private final String SMTP_PORT = "587";
- Customize the checkin and checkout e-mail confirmations by changing the variables in the e-mail settings section.
/** e-mail settings */ private final String LIBRARY_NAME = "Datalogisk Institut"; private final String LIBRARY_PHONE = "29979812"; private final String HOME_PAGE = "http://diku.dk"; private final String BANNER = "http://diku.dk/english/about/topgrafik/AboutDIKU_Top_505px.jpg?size=700x267"; private final String FB_ICON = "https://images2.imgbox.com/dd/7b/dERSD77S_o.png"; private final String FB_LINK = "https://www.facebook.com/universitet"; private final String TWITTER_ICON = "https://images2.imgbox.com/17/29/H9U3G6if_o.png"; private final String TWITTER_LINK = "https://twitter.com/uni_copenhagen";
mvn clean install
docker rmi mod-elf
docker container prune
docker build -t mod-elf .
- Set-up environment (see 0-installation docs).
sudo ifconfig lo0 alias 10.0.2.15 brew services restart [email protected] open -a Docker # wait for Docker to start before running next cmd docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 127.0.0.1:4243:4243 bobrik/socat TCP-LISTEN:4243,fork UNIX-CONNECT:/var/run/docker.sock
- Deploy Okapi
cd ~/Desktop/folio java \ -Dstorage=postgres \ -Dpostgres_host=localhost \ -Dpostgres_port=5432 \ -Dpostgres_user=okapi \ -Dpostgres_password=okapi25 \ -Dpostgres_database=okapi \ -Dhost=10.0.2.15 \ -Dport=9130 \ -Dport_start=9131 \ -Dport_end=9151 \ -DdockerURL=http://localhost:4243 \ -Dokapiurl=http://10.0.2.15:9130 \ -jar bl/okapi/okapi-core/target/okapi-core-fat.jar dev
- Deploy Okapi modules (necessary for permissions-module-4.0.4).
source activate folio python ~/Desktop/folio/bl/dev-ops/deploy_modules.py source deactivate folio
- Change to mod-elf directory.
cd ~/Desktop/folio/bl/mod-elf
- Only Once: Register
mod-elf
.curl -w '\n' -X POST -D - \ -H "Content-type: application/json" \ -d @target/ModuleDescriptor.json \ http://localhost:9130/_/proxy/modules curl http://localhost:9130/_/proxy/modules
- Deploy
mod-elf
as a Docker container.curl -w '\n' -D - -s \ -X POST \ -H "Content-type: application/json" \ -d @target/DockerDeploymentDescriptor.json \ http://localhost:9130/_/discovery/modules curl -i -w '\n' -X GET http://localhost:9130/_/discovery/modules
- Only Once: Enable
mod-elf
fordiku
tenant.curl -w '\n' -X POST -D - \ -H "Content-type: application/json" \ -d @target/EnableDescriptor.json \ http://localhost:9130/_/proxy/tenants/diku/modules curl http://localhost:9130/_/proxy/tenants/diku/modules
- Request
itemInfo
throughmod-elf
.# LOGIN and get x-okapi-token and use it for the next requests curl -i -w '\n' -X POST -H 'X-Okapi-Tenant: diku' \ -H "Content-type: application/json" \ -d '{"username": "diku_admin", "password": "admin"}' \ http://localhost:9130/authn/login # GET elf info curl -i -w '\n' -X GET \ -H 'Content-type: application/json' \ -H 'X-Okapi-Token: [Replace_With_Token]' \ -H 'X-Okapi-Tenant: diku' 'http://localhost:9130/iteminfo?limit=30&query=itemid%3D%22459afaba-5b39-468d-9072-eb1685e0ddf4%22'
- Tear-down
ctrl + c
out of okapi and stripes.docker kill $(docker ps -q) docker container prune brew services stop [email protected] sudo ifconfig lo0 -alias 10.0.2.15
Note: Launch descriptor has a path relative to the directory that java -jar okapi-core-fat.jar
was executed in (likely ~/Desktop/folio
).
- Unregister mod-elf from Okapi gateway.
# undeploy mod-elf curl -w '\n' -X DELETE -D - http://localhost:9130/_/discovery/modules/mod-elf-1.0.0/10.0.2.15-9143 # disable mod-elf for diku curl -w '\n' -X DELETE -D - http://localhost:9130/_/proxy/tenants/diku/modules/mod-elf-1.0.0 # unregister mod-elf curl -w '\n' -X DELETE -D - http://localhost:9130/_/proxy/modules/mod-elf-1.0.0
- List registered modules.
# list deployed modules curl -i -w '\n' -X GET http://localhost:9130/_/discovery/modules # list modules enabled for diku user curl -i -w '\n' -X GET http://localhost:9130/_/proxy/tenants/diku/modules # list modules registered with okapi curl -i -w '\n' -X GET http://localhost:9130/_/proxy/modules