HUB
Sign inSign up
estimate-beehive logo

informationcatalyst/estimate-beehive

By informationcatalyst

•Updated over 4 years ago

Image
0

367

informationcatalyst/estimate-beehive repository overview

⁠Deployment

The instance will be installed on pilots premises.

Note: The repository and full deployment guide (including supporting images) can be found at: https://gitlab.h2020-demeter-cloud.eu/demeterproject/wp4/decisionsupport/4.a.cropgrowthstatusyield/4.a.5-estimatebeehive/estimatebeehive/-/blob/6-simplification-to-provide-singular-endpoint/docs/deployment-guide.md⁠

Refer to the following sections for installation and usage:

⁠Installation Requirements

NameVersionNotes
Docker20.10.10Docker docs⁠
Docker-Compose2.1.1Docker Compose docs⁠

⁠Setup local instance

⁠Estimate Beehive Registration on ACS
  1. Sign-up on ACS (follow Option A in this guide: Demeter User Signup & Activate⁠.

  2. Sign into the Demeter Access Control System to access its Home Page.

  3. In the Home Page, select the Register button.

  4. Once Register has been selected, a three-step registration form will be presented.

    1. Complete the following fields and then select Next:

      • Name: Name of the application
      • Description: Application Description
      • Url: http://localhost:8071/
    2. Select an image to use as an application icon (Optional) and then Select Next.

    3. Select the "+" on the roles section and add the role "USER".

    4. Next, with the USER role selected, Select the "+" on the Permissions section and complete the following fields:

    5. Finally, select the "beehive-estimation" permission for the USER role, and then the Save button to complete the application's registrations in the ACS.

    ** Note: The Url and Role fields can be updated as required. However, the corresponding variables will need to be updated in the applications .env file before deployment.

  5. Select OAuth2 Credentials and note down the Client ID and Client Secret.

⁠Authorization

The Estimate Beehive Component can be called by other applications registered in the ACS, and Users.

⁠To authorize another Demeter application to use the component:
  • On the Trusted Applications section, select the "+ Add" button.

  • In the Applications field, search for the client application intending to use the Estimate Beehive Component. Once found, select the "+" button. When the application is displayed in the Trusted Applications section, select the Save button.

⁠To authorize a Demeter User to use the component:
  • On the Authorized Users section, select the "Authorize" button.

  • In the Users field, search for the user intending to use the Estimate Beehive Component. Once found, select the "+" button.

  • Next, select the Roles drop-down box, and apply the "USER" role, or the role applied in the ".env" file above.

  • When the user is displayed in the Authorized Users section, and a tick is displayed next to the role "USER", select the Save button.

⁠Communication check between VM and ACS

Before proceeding to the next steps, it is recommended that you verify the communication between the docker Virtual Machine (VM) and ACS by running the following command:

for bash shell use this:

curl --location --request POST 'https://acs.bse.h2020-demeter-cloud.eu:5443/v1/auth/tokens' --header 'Content-Type: application/json' --data '{
  "name": "ACS_MAIL",
  "password": "ACS_PASSWORD"
}'

for native cmd shell use this:

curl --location --request POST "https://acs.bse.h2020-demeter-cloud.eu:5443/v1/auth/tokens"  --header "Content-Type: application/json" ^
	--data "{ \"name\": \"ACS_MAIL\" , \"password\": \"ACS_PASSWORD\" } "

Put your ACS account mail on ACS_MAIL and your ACS password on ACS_PASSWORD.

The communication test is considered successful if the following response is received:

{"token":{"methods":["password"],"expires_at":"2021-11-30T12:36:50.671Z"},"idm_authorization_config":{"level":"advanced","authzforce":false}}

If this test is not successful, then you must check with the ACS administrator that port 5443 is open and can connect to the ACS host.

⁠Configure Application Deployment
  1. Create a directory on the machine that will host the Estimate Beehive Component
  2. Create a new file inside the folder named "docker-compose.yml".
  3. Copy and Paste the content below into the docker-compose file.
version: '3.8'

services:
  estimate-beehive-component:
    image: informationcatalyst/estimate-beehive:v2
    container_name: estimate-beehive-component
    ports:
      - ${SERVER_PORT}:${SERVER_PORT}
    environment:
      - SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE}
      - SERVER_PORT=${SERVER_PORT}
      - ACS_ESTIMATE_BEEHIVE_CLIENT_ID=${ACS_ESTIMATE_BEEHIVE_CLIENT_ID}
      - ACS_ESTIMATE_BEEHIVE_CLIENT_SECRET=${ACS_ESTIMATE_BEEHIVE_CLIENT_SECRET}
      - ACS_ESTIMATE_BEEHIVE_ADMIN_EMAIL=${ACS_ESTIMATE_BEEHIVE_ADMIN_EMAIL}
      - ACS_ESTIMATE_BEEHIVE_ADMIN_PASSWORD=${ACS_ESTIMATE_BEEHIVE_ADMIN_PASSWORD}
      - ACS_ESTIMATE_BEEHIVE_ROLE=${ACS_ESTIMATE_BEEHIVE_ROLE}
  1. Create a new file inside the same folder named ".env".
  2. Copy and Paste the content below into the .env file.
SPRING_PROFILES_ACTIVE=prod
SERVER_PORT=8071
ACS_ESTIMATE_BEEHIVE_CLIENT_ID=<CLIENT ID FROM ACS>
ACS_ESTIMATE_BEEHIVE_CLIENT_SECRET=<CLIENT SECRET FROM ACS>
ACS_ESTIMATE_BEEHIVE_ADMIN_EMAIL=<ADMIN EMAIL>
ACS_ESTIMATE_BEEHIVE_ADMIN_PASSWORD=<ADMIN PASSWORD>
ACS_ESTIMATE_BEEHIVE_ROLE=USER
  1. Set ACS_ESTIMATE_BEEHIVE_CLIENT_ID= to the acs client id noted down in the registration process.

  2. Set ACS_ESTIMATE_BEEHIVE_CLIENT_SECRET= to the acs client secret noted down in the registration process.

  3. Set ACS_ESTIMATE_BEEHIVE_ADMIN_EMAIL= to the email of the account used to register the application in the ACS.

  4. Set ACS_ESTIMATE_BEEHIVE_ADMIN_PASSWORD= to the password of the account used to register the application in the ACS.

  5. If the host port 8071 is already taken, set another one, i.e. "8080".

  6. Set ACS_ESTIMATE_BEEHIVE_ROLE= to the role creating in the registration process.

⁠Running the application

Run the command docker-compose up -d to start the service.

Run the command docker-compose down to stop the service.

A successful deployment can be seen below, where docker ps is also used to check on the deployment status.

To validate network access to the component, paste the following URL into a browser to view the API Swagger Documentation. http://localhost:8071/documentation/swagger-ui

Tag summary

Content type

Image

Digest

Size

306.3 MB

Last updated

over 4 years ago

docker pull informationcatalyst/estimate-beehive