# Deployment Guide for Handshake ## Quick Reference 1. Admin UI :8080/handshake 2. REST Service :8080/handshake-services/swagger-ui.html#/ ## Docker Deployment 1. Get the Handshake image location from a Perficient administrator. 2. Use the following command to get and run your image: ``` docker run -p 8080:8080 -p 9990:9990 prftdata/handshake-:latest ``` ## Standalone Installation 1. Install Java 2. Set Up and Configure Wildfly 3. Set up Apache Derby 4. Set up Mongodb 5. Deploy Handshake Wars 6. Verify Web Services ### Java Installation _Handshake requires Java 8 to run._ 1. Download and install the Java 8 SDK from [here](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). Make sure to download the correct version for your OS (32 vs 64 bit). 2. Once you've installed Java, create an environment variable called **JAVA_HOME** that points to the installation directory of the JDK folder (not the JRE folder). For example: `C:\Program Files\Java\jdk1.8.0_221.` ### Wildfly Set Up 1. Download and copy to your preferred location Widlfly 17.0.1.Final from [here](https://wildfly.org/downloads/). * As of the date above, Wildfly 17.0.1.Final is the only supported version of Wildfly. If you use a newer version, you will have to debug Wildfly and handshake yourself. (There were 4 options to download) 2. Once you've copied the Wildfly distribution to your preferred location, go to the /bin folder in a command prompt, and run the **add-user.bat** script. Follow the prompts to add an administrator user and set that user's password. You will need this user to log into the Wildfly admin console, located at the following URL: `http://localhost:9990/console` * Create new user, select Management Then select username and password. When asked what groups this user will need access to add admin. * “Is this user going to be used for one AS process to connect to another AS process?” Yes 3. **(Optional)** You can start Wildfly from a command prompt using the **standalone.bat** script to test that the admin console is running. Once Eclipse has been configured, You can use Eclipse integration to start and stop Wildfly. #### Wildfly Configuration You will need to configure your wildfly queues to auto run. ! What about port set ups? ! 1. Navigate to Configuration > Subsystems > Messaging > Server > Default > Destinations > View. The Messaging option will not be visible unless Wildfly has standalone-full.xml set as the configuration file. 2. Address setting tab. Click # Row, then edit 3. Turn on Auto Create Queues option 4. Save ### Apache Derby Database Set Up (Mandatory) Download the Derby tools [here](https://db.apache.org/derby/releases/release-10.14.2.0.cgi). Ensure you are using a version of Derby compatible with the version of Java in use for your project. After you've downloaded Derby, go [here](https://builds.apache.org/job/Derby-docs/lastSuccessfulBuild/artifact/trunk/out/getstart/index.html) and follow the steps under 'Installing and configuring Derby'. Once you've downloaded and installed the tools, you can follow the instructions here to create the Derby database, as well as use the console tools to interact with your tables. Note that the codebase is pointing at a default location of: C:/testDocumentDb. Currently the SCF project uses Java 8, and Derby 10.14.2.0 (download) is the highest compatible version. * Use higher versions at your own risk! * While configuring the DERBY DB, run this command 1. Create a handshake directory in the root derby directory 2. Copy quartz_tables_derby.sql from /handshake/src/main/resources/db/quartz_tables_derby.sql into it 3. Go to handshake/src/main/resources/application.properties and set spring.datasource.jdbc-url=jdbc:derby:/db-derby-10.14.2.0-bin/handshake/handshake-quartz 4. Run the below commands ``` $ ij ij version 10.15 ij> connect 'jdbc:derby:handshake-quartz;create=true'; ij> run 'quartz_tables_derby.sql'; ij> exit; ``` ### MongoDB Set Up 1. Download [MongoDB Community Server](https://www.mongodb.com/try/download/community) version 4.2.8 2. After installation, create a directory to contain your local database 3. Open a command prompt and navigate to the bin directory of MongoDB using the "cd" command. On Windows the path should look something like "C:\Program Files\MongoDB\Server\4.2\bin" 4. Once in the bin directory enter the command: mongod.exe --dbpath "{path to database created in step 2}". After entering the command the mongoDB you should see a message that includes "waiting for connections". 5. Open another command prompt, repeat step 3, then Enter the command: mongo.exe 6. You are now connected to your local MongoDB instance. Commands found at this [tutorial](https://docs.mongodb.com/manual/tutorial/getting-started/) can now be used. Only step 5 must be repeated for future connections to the MongoDB. ### Deploy Handshake Wars 1. Navigate to Wildfly > Deployments 2. Upload Deployments by clicking the (+) icon and selecting "Upload Deployment" 3. Drag the handshake-services.war file to the upload box. Click Next. 4. Make sure the toggle is set to "Enabled" and click Next. 5. Repeat steps 2-4 for handshake.war ### Verify web services 1. Once the project is deployed, navigate to ```http://localhost:8080/handshake-services/swagger-ui.html#``` and verify you can invoke the REST endpoints. These are the controller level REST calls 2. Navigate to ```http://localhost:8080/push-rest/swagger-ui.html#``` and verify these endpoints are good, too. These are the REST calls for Pull sources, such as Coveo ### Vault setup on local development environment 1. User may choose to run vault on development environment provided ```vault.enabled``` in handshake ```application.properties``` is set to true. Steps can be found in the link below: [https://learn.hashicorp.com/vault/getting-started/dev-server] 2. Or can skip it by setting ```vault.enabled``` to false