Oracle Code Day Hands On Labs HOL

Similar documents
Oracle Code Day Hands On Labs (HOL) (Install, Repository, Local Deploy, DevCS, OACCS)

BUILD AND DEPLOY SOA PROJECTS FROM DEVELOPER CLOUD SERVICE TO ORACLE SOA CLOUD SERVICE

Sample Spark Web-App. Overview. Prerequisites

BUILD AND DEPLOY ORACLE SERVICE BUS PROJECTS FROM ORACLE DEVELOPER CLOUD SERVICE TO ORACLE SOA CLOUD SERVICE USING THE ORACLE SERVICE BUS PLUG-IN

Maven POM project modelversion groupid artifactid packaging version name

How to Install (then Test) the NetBeans Bundle

Lab 03 Finish and Deploy an Application. Lab 3-1: Add DELETE to the Spring Boot REST Application

Setup and Getting Startedt Customized Java EE Training:

BlueMix Hands-On Workshop Lab A - Building and Deploying BlueMix Applications

For live Java EE training, please see training courses at

CSCI 201 Lab 1 Environment Setup

Continuous Integration (CI) with Jenkins

Sonatype CLM - IDE User Guide. Sonatype CLM - IDE User Guide

vrealize Code Stream Plug-In SDK Development Guide

EUSurvey OSS Installation Guide

Oracle Cloud Using Oracle Developer Cloud Service

Running the ESPM Twitter Integration sample app on SAP Cloud Platform

Topics covered. Introduction to Maven Maven for Dependency Management Maven Lifecycles and Plugins Hands on session. Maven 2

Software Installation Guide

AUTOMATION TESTING FRAMEWORK FOR LUMINOUS LMS

What is Maven? Apache Maven is a software project management and comprehension tool (build, test, packaging, reporting, site, deploy).

Installation Guide - Mac

Using the Computer Programming Environment

Continuous Integration INRIA

Red Hat JBoss Enterprise Application Platform 6.4

Red Hat JBoss Developer Studio 10.3 Getting Started with JBoss Developer Studio Tools

Lab 1 1 Due Wed., 2 Sept. 2015

JDK-WildFly-NetBeans Setup Local

Ansible Tower Quick Setup Guide

APAR PO06620 Installation Instructions

MAVEN MOCK TEST MAVEN MOCK TEST I

Installation Guide - Windows

Red Hat Developer Studio 12.0

IBM. IBM WebSphere Application Server Migration Toolkit. WebSphere Application Server. Version 9.0 Release

Composer Guide for JavaScript Development

MAVEN INTERVIEW QUESTIONS

Exercise 1. Bluemix and the Cloud Foundry command-line interface (CLI)

What s NetBeans? Like Eclipse:

VII. Corente Services SSL Client

Sonatype CLM Enforcement Points - Nexus. Sonatype CLM Enforcement Points - Nexus

Red Hat JBoss Web Server 3.1

An Introduction to Eclipse Che Lets build a custom cloud IDE. October 2015 Tyler Jewell, Eclipse Che Project

SAP NW CLOUD HANDS-ON WORKSHOP

Content. Development Tools 2(57)

Import Data Connection to an SAP ERP System

Import Data Connection from an SAP Universe

EUSurvey Installation Guide

Developing Android applications in Windows

Create Import Data Connection to SAP BPC MS

Setting up a Maven Project

Setting Up the Development Environment

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

Continuous Integration, Continuous Deployment and Continuous Testing by HP Codar using ALM and Jenkins

4. Check the site specified in previous step to work with, expand Maven osgi-bundles, and select slf4j.api,

10.1 Getting Started with Container and Cloud-based Development

Polarion Trial Installation 17.2

CONTINUOUS DELIVERY IN THE ORACLE CLOUD

ActiveSpaces Transactions. Quick Start Guide. Software Release Published May 25, 2015

Java with Eclipse: Setup & Getting Started

Set up Maven plugins in Eclipse. Creating a new project

Getting started with Geomajas. Geomajas Developers and Geosparc

Import Data Connection to an SAP BW System

NetApp Jenkins Plugin Documentation

JBoss Enterprise Application Platform 6.2

TIBCO LiveView Web Getting Started Guide

Build Tools. Software Engineering SS A tool was needed. Agenda for today. Build tools. Software complexity. Build tools

Contents. Anaplan Connector for MuleSoft

Cisco CVP VoiceXML 3.1. Installation Guide

Hands-On Lab. Windows Azure Virtual Machine Roles. Lab version: Last updated: 12/14/2010. Page 1

Red Hat JBoss Developer Studio 11.3

Build Tools. Software Engineering SS 2007

BlueMix Hands-On Workshop

ForeScout Extended Module for MaaS360

EMC Documentum Composer

Managing System Administration Settings

Eclipse Environment Setup

3 Connecting to Applications

Using SourceTree on the Development Server

Setting Up Resources in VMware Identity Manager (On Premises) Modified on 30 AUG 2017 VMware AirWatch 9.1.1

DevOps for Oracle Forms Using Developer Cloud Service

JBoss Portal Quickstart User Guide. Release 2.6.6

User Guide. Kronodoc Kronodoc Oy. Intelligent methods for process improvement and project execution

Force.com IDE Developer Guide

Cloud Computing II. Exercises

Application prerequisites

Getting Started with Cisco UCS Director Open Automation

vsphere Web Client SDK Documentation VMware vsphere Web Client SDK VMware ESXi vcenter Server 6.5.1

Introduction... 5 Configuring Single Sign-On... 7 Prerequisites for Configuring Single Sign-On... 7 Installing Oracle HTTP Server...

Web Age Solutions Inc. WA2639 Devops with Jenkins, Terraform and Hashicorp Stack. Classroom Setup Guide. Web Age Solutions Inc. 1

Managing Load Plans in OTBI Enterprise for HCM Cloud Service

NSIGHT ECLIPSE EDITION

Standard Edition (SE) application development Enterprise Edition (EE) enterprise development Micro Edition (ME) Internet of Things (IoT) development

Index. Chaminda Chandrasekara 2017 C. Chandrasekara, Beginning Build and Release Management with TFS 2017 and VSTS, DOI /

Dell EMC ME4 Series vsphere Client Plug-in

TIBCO LiveView Web Getting Started Guide

HPE Security Fortify Plugins for Eclipse

VMware AirWatch Integration with RSA PKI Guide

Continuous Integration & Code Quality MINDS-ON NUNO 11 APRIL 2017

We start by providing you with an overview of the key feature of the IBM BPM Process Portal.

Pearson System of Courses (PSC) Deploying PSC with System Center Configuration Manager (SCCM) for Windows

Transcription:

Oracle Code Day Hands On Labs HOL Overview This lab guides you through deploying and running the BlackJack application "locally" via a Tomcat server that is spawned by NetBeans. After successfully running the BlackJack application locally on your VM, you will then place your application code on the Oracle Developer Cloud service by cloning your local Git repository to the cloud, where you then build, deploy, and run the application. You also learn how to create an application archive of the BlackJack application that can be used to deploy your application on the cloud. Learning Objectives In this Hands-On Lab session, you will learn how to: Configure, build, deploy, and run the BlackJack application locally Generate deployable archive files of the BlackJack application for deployment on the cloud Create a new project in the Developer Cloud Service Create and clone a Git repository in the Developer Cloud Service Build the BlackJack application in the Developer Cloud Service Deploy the BlackJack application from the Developer Cloud Service onto the Application Container Service Test the deployed BlackJack application that is running on the Application Container Service Prerequisites Ensure that you have a working Oracle Cloud account that you can access Successfully establish a VNC connection to a VM environment that has been supplied for you

Lab Environment You will do the labs on a VM that has been provided to you. Note: All necessary installations and configurations of software have been done in the VM. If wish to do the practices on your laptop, you will need to do the installs and configurations of the software. The following software has been installed software on the VM: JDK - Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. o It includes the Java Runtime Environment (JRE), an interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation generator (javadoc) and other tools needed in Java development. Netbeans - A software development platform written in Java. o Applications are developed from a set of modular software components called modules. Used for development in Java, PHP, C/C++, and HTML5 GIT - Open source version control system (VCS) for tracking changes in computer files Maven - Apache Maven is a software project management tool. o Describes how software was built, and it describes its dependencies Notepadd++ - A text editor and source code editor. It supports tabbed editing, which allows working with multiple open files in a single window. Lab Files On the Desktop of the VM is the HOL lab files directory. It contains files you will use in the labs. BlackJack.zip Helloworld-Example.zip Pom.xml

The Cloud Services use in HOL session Before you get started, take a few moments to familiarize yourself with the Oracle Developer Cloud Service and Oracle Application Container Service, which you will use in the HOL lab. Oracle Developer Cloud Service (ODCS) Oracle Developer Cloud Service is a software development Platform as a Service (PaaS). As part of Oracle Cloud, Oracle Developer Cloud Service simplifies development with an automatically provisioned, scalable development platform supporting the complete development lifecycle. Within minutes, you and your team have immediate access to source repositories, issue tracking, builds, and more. Oracle Developer Cloud Service has these key features: Project configuration and user management Source control repositories through Git and Maven A defect tracking system to track tasks, bugs, and enhancements Continuous build integration through Hudson Document collaboration through wiki The web interface provides project creation and management, a dashboard to display the latest activity and build status, an issue tracking interface to edit and query defects and tasks, a wiki interface to write project documentation, a Hudson view to manage builds, and a Team view to configure teams and define roles. Oracle Developer Cloud Service also integrates into popular IDEs, including Eclipse, JDeveloper, and Netbeans. IDE users can develop and commit code through Git integration tools, work with Tasks and Defects through Mylyn integration, monitor builds, and more. Oracle Developer Cloud Service also provides an SSH access to interact with the hosted Git repositories. Oracle Developer Cloud Service provides tight integration with Java Cloud Service. You can manually deploy application build results from Hudson to your Java Service instance, or you can configure continuous deployment. In addition, you can deploy build results to your on premise production environment.

Oracle Application Container Cloud Service (OACCS) OACCS includes Oracle Java SE Cloud Service, which lets you deploy Java applications to the Oracle Cloud, and Oracle Node Cloud Service, which lets you deploy Node.js applications to the Oracle Cloud. You can also deploy PHP applications. When you deploy your application, you specify whether it s a Node.js, Java, or PHP application. Subscribing to Oracle Application Container Cloud Service makes all types available when you deploy. Your application runs in "https://www.docker.com/what-docker" target="_blank">docker container. Oracle Application Container Cloud Service has these key features: A pre-configured environment for Java, Node.js, and PHP applications. Java SE advanced features such as Java Flight Recorder, Java Mission Control, advanced memory management, and ongoing and timely security updates. Open platform that supports all Java frameworks and containers such as Spring, Play, Tomcat, and Jersey. Support for Java Virtual Machine (JVM) based languages such as JRuby. You can run any language that uses the Java Virtual Machine on this service. Enterprise-grade support from Oracle. Web-based user interface and REST API. In addition, you can choose to integrate with other Oracle Cloud services. You can develop your application on your local system, or you can use Oracle Developer Cloud Service.

Preparing the environment for Building and Deploying Applications To provide you the time you will need to build and deploy application with Oracle Cloud Services during in the HOL session, the following installation and configuration steps has been completed for you. Please review the following to understand what you will need to do to set up your environment for building and deploying applications in the Oracle Cloud 1) Install and configure JDK, Netbeans, Git and Maven 2) Setting Proxy for Maven Apache Maven is a software project management tool. When you use Maven, it will go the Maven site to download the modules you will use. If you are connected to a network, like on your company s network, and a HTTP proxy server is set up to prevent connection to the internet directly, then you must set up proxy for Maven or Maven will fail to download any dependencies As you are connected to an Oracle University environment to do your practices, you are connected to a network with a HTTP proxy server. You will need to set proxy for Maven. For the HOL session, proxy has been set with the proxy address of the environment you are using for Maven. Review the settings.xml file in the following two locations to see how to set proxy with the proxy address of the environment you are using for Maven. Look under the <proxies> tag. WINNT(D:)>Program Files>NetBeans8.2>java>maven>conf WINNT(D:)>Maven>apache-maven-3.3.9>conf 3) Creating and Configure a Git Repository Git is a tool you use to manage a project, or a set of files, as they change over time. Git stores information in a data structure called a repository. A Git repository contains, among other things: sets of commit objects, and references to commit objects The following commands were executed in Git Bash to create, and initialize a local GIT repository under the home directory of the VM a) Create a Git Repository i) Click on the Git Bash on the Desktop to launch Git Bash ii) iii) iv) Create a cloud directory - mkdir cloud Change the directory to cloud directory - cd cloud Create a Git repository - git init The cloud directory is now a Git repository.

v) Execute the ls a command to confirm the same. The output of the ls a command must match the output in the following screenshot: You should see that a.git directory has been created inside the cloud directory, your repository is ready. b) Configuring a GIT Repository Before you can commit changes to GIT repository, you must configure your name and email address to identify your commits in the repository. i. Execute the following commands to configure your name: git config --global user.name Your Name Example: git config global user.name John Doe ii. Execute the following commands to configure your email address: git config --global user.email your-email@address Example: git config global user.email john.doe@oracle.com iii. To confirm that the values have been set, execute the following command: git config --global l You should see the following: Notes: This sets your name and email address for all GIT projects. Don t use --global option to set the name and email address at the project level.

Test, Build and Deploy the BlackJack Web Service App I) Deploying the BlackJack Application on a Local Server For the VM used in the HOL session, the following steps were done to deploy the BlackJack application locally to Apache Tomcat Server bundled with the project. 1) On the Desktop, right click and create a directory and name it Cloud 2) Copy the Blackjack.zip from the HOL lab files directory into the Cloud directory 3) Right click on the BlackJack.zip file, select 7-Zip, click Extract files, click OK and accept the location. When you extract Blackjack.zip, you will see the Blackjack directory, and two sub-directories (Blackjackpart2 and html5-client) The source for the Blackjack application has been created for you. It is in the Scr directory in the Blackjack-part2 directory Blackjack-part2 Scr Source code for Blackjack Manifest.json Configuration file for deploying to Oracle Application Container Cloud Service Pom.xml Defines plugs in for Maven html5-client cards folder Images of the deck of cards lib folder jquery files jquery is a feature-rich JavaScript library so to use JavaScript on your website. CSS files - CSS is the language for describing the presentation of the web pages index.html An html file (HyperText Markup Language), it defines the structure and layout of a web page. request.json A json file, JSON ( JavaScript Object Notation) use to store information of how you request your cards in Blackjack 4) Launch Netbeans using the NetBeans IDE icon on the desktop.

5) Open the Blackjack project, a. In Netbeans - File>Open Project b. Select from Desktop>Cloud>Blackjack> blackjack-part2 c. Click Open Project Note: If all source resources are not available, you might see the following on the screen If you see the screen, click on Resolve Problems. It will open a Resolve Project Problems window, click Resolve. When Netbeans have download the Maven related files, you will see the Final Memory amount in the Output Window area, then click the Close button in the Resolve Project Problems window. 6) Right-click the backjack-part2 project and select the Clean and Build. A CLEAN and BUILD will build your application for deployment. When you use the Clean and Build command, the IDE runs a build script that performs the following tasks: a. Deletes any previously compiled files and other build outputs. b. Recompiles the application and builds a JAR file containing the compiled files

7) Deploy the project on Tomcat Server a. Right click the backjack-part2 project and select Run. b. Select com.example.blackjack.rest.application from the Available Main Classes list, and click the Select Main Class button. c. You know your application has started and is running when you see a Started Application in <<seconds>> seconds (JVM running for 5.19) message in the Output window. Note: You may encounter a problem in running this project if there port conflict. This application will be deployed to Apache Tomcat Server and it requires local port 8080 to listen to the client request. Make sure you stop the any services running on local port 8080. TCPView tool can be used to identify and terminate the process using this port number. [Download Link](https://technet.microsoft.com/en-us/sysinternals/bb897437)

START HERE FOR THE CODE DAY HOL (HANDS ON LAB) As the install and configuration has been done for you, you are starting with the next step - Testing the Locally Deployed BlackJack Application II) Testing the Locally Deployed BlackJack Application Before you run the gaming console of the Blackjack application that has been deployed locally to the VM of the machine you have been assigned to, let s review what has been done on that VM. What has been completed in VM: 1. Installed JDK, Netbeans, Git and Maven 2. Set proxy for Maven 3. Created Cloud directory on Desktop of VM 4. Created, and initialized a local GIT repository 5. Deployed the BlackJack Application on a Local Server This is showing the Desktop on the machine provided by Oracle University. When you log in to the machine, you will not see software started like below, it just intent to show an example of the Desktop when some software (Explorer, Netbeans, and Firefox) is launch. An HTML-5 client application interacts with the BlackJack gaming application deployed on the Tomcat Server that is installed locally when Netbeans was installed on the VM. 1) Launch Netbeans using the NetBeans IDE icon on the desktop.

2) Open the Blackjack project, a. In Netbeans - File>Open Project b. Select from Desktop>Cloud>Blackjack> blackjack-part2 c. Click Open Project 3) Deploy the project on Tomcat Server a. Right click the backjack-part2 project and select Run. b. Select com.example.blackjack.rest.application from the Available Main Classes list, and click the Select Main Class button. c. You know your application has started and is running when you see a Started Application in <<seconds>> seconds (JVM running for <<number>>) message in the Output window. 4) Run Blackjack application locally a. Go to Desktop>Cloud > BlackJack > html5-client directory. b. Open the index.html file with Firefox, or enter file:///d:/users/administrator/desktop/cloud/blackjack/html5-client/index.html in the browser c. Make sure that the first field, Service, is populated with <http://127.0.0.1:8080/> value, enter a number between 1 and 9 in the second field, and then click Connect.

5) Once you connect to the Blackjack application gaming console a. Click the Debug on/off button to view the Debug console. b. You can use the Hit and Stand buttons available on the UI to play the game. 6) Close this HTML5 Client application once you are done.

III) Generating Application Archive Files for the BlackJack Application Oracle Application Container Cloud can deploy and run Java Platform, Standard Edition (Java SE), and Node.js applications. First, to deploy your application, we compress the application in a ZIP or Gzipped Tar (TGZ) archive file, which includes the required configuration information. You will use Oracle Application Container Cloud Service later in the lab. 1) Create an application archive. i. Open the blackjack-part2 application in Netbeans if it is not opened already. ii. Right-click the project and click Clean. A Clean will remove what you have created before.

iii. When you see Build Success in the output window, the Clean is completed. iv. Open a graphical file explorer, navigate Desktop> Cloud > BlackJack > blackjack-part2, and make a note of the directory structure and its contents. Note: The manifest.json file is required for all applications deployed to Oracle Application Container Cloud Service. If this file is not present in the root directory of the.zip,.tar, or.tar.gz file, deployment will fail. At a minimum, this file specifies the major version of the runtime environment and the launch command. Note also, in the manifest.json file, it shows a java -jar Blackjack-part2-1.0.jar file will be created as a result of a Build. Content of the manifest.json file: { "runtime": { "majorversion": "8" }, "command": "java -jar blackjack-part2-1.0.jar", "release": { "version": "1.0", "build": "1", "commit": "1A2B345" }, "notes": "Blackjack Web Service" } ```

v. Switch to Netbeans, right-click the blackjack-part2 project, and click Build. A Build will compile only the source files that need to be compiled & links them together to form a new binary. vi. vii. When you see Build Success in the output window, the Build is completed Switch to the file explorer, Desktop>Cloud > Blackjack > blackjack-part2 directory and notice that a new directory named target is created. Examine the target directory. You will notice that.zip and.tar.gz distribution files have been generated. These are application archive files you will use to deploy to OACCS.

IV) Logging into Oracle Cloud account, and Setting Replication Policy In the upcoming lab, you will require storage in the Cloud when you create an empty project with a repository to push your application to Developer Cloud Service. To protect the items you store in Oracle Cloud, you must define, the Replication Policy. You will choose a replication policy (if it is not already done by the Identity Domain Administrator) to define your primary data center and also specifies whether your data should be replicated to a geographically distant (secondary) data center. The Cloud Account you will use during the HOL session already has the Replication Policy set. The following is showing you what you might need to do for your Cloud account. So, the HOL session, you DO NOT need to set Replication Policy. Just log into the Cloud Account and continue with the lab. Have available, the cloud login credentials and link you received from Oracle. 1) Login to your Oracle Cloud Account a. Go to the URL: https://cloud.oracle.com/ b. Click Sign In IMPORTANT: Using the credentials provided by your instructor or from the information from your Trial confirmation email, select from the drop down list the correct data center, and click on My Services.

NOTE: The Identity Domain, User Name and Password values will be given to you by the instructor or within your Trial confirmation email. c. Enter your Identity Domain and click Go. d. Enter your User Name and Password and click Sign In e. You will see a Dashboard displaying the various cloud services available to this account.

2) Customize Display of Services on Dashboard a. If your Storage cloud service is not visible, click on the Customize Dashboard. b. To add services to the dashboard, click, Show. For the labs of this HOL, you will want to ensure that you are showing at least the Application Container, Developer and IaaS Storage cloud services. If you do not want to see a specific service on the Dashboard, click Hide 3) Set Storage Replication Policy As you do not need to set Replication Policy in the HOL session, proceed to - (V) - Creating a New Project in Developer Cloud Service (DevCS) Depending on the state of your Cloud Account, you may need to set the replication policy, if it has not been previously set. Go to the Storage Cloud Service to check on the status of the Replication Policy.

a. Click on the Storage Cloud Service b. Click on the Open Service Console icon at the top of the screen. c. If the follow dialog is displayed, Replication Policy Not Set, then you will need to set the Replication Policy. Care must be taking when setting your replication policy, because it cannot be changed. i. From the Actions menu, select Set Replication Policy ii. The Set Replication Policy dialog box appears. It displays the available data centers and replication policies for your Oracle Storage Cloud Service instance. iii. Select the data centers locations iv. After selecting a replication policy, click Set. v. The Confirm Replication Policy Selection dialog box appears vi. Take the default and click on the Set Policy button. Your replication policy is now set V) Creating a New Project in Developer Cloud Service (DevCS) Create an empty Project in Developer Cloud Service 1) On the Developer Cloud Service on the Dashboard, and click on the menu (gray horizontal lines). Click the Open Service Console button. Note: developer34358, the name of the Service instance in DevCS, it will be different for every user 2) On the Developer Cloud Service page, Click New Project

3) Enter the Project Name and Description as shown in the following screenshot and click Next 4) Click the Empty Project template and Next. 5) Select MARKDOWN from the Wiki Markup drop-down list and click Finish. Markdown is a plain-text formatting, and a software tool, written in Perl, that converts the plain text formatting to HTML

6) Provisioning BlackJackProj project may take several minutes. When provisioning is completed, there will be a check next to all the modules. 7) The home screen of the BlackJackProj will be display

VI) Creating a GIT Repository in Developer Cloud Service Oracle Developer Cloud Service uses GIT source control management to save and manage your application source code files. Create an empty GIT repository in Developer Cloud Service. 1) The home screen of the BlackJackProj, Click the New Repository button in the REPOSITORIES section. 2) In the New Repository window, enter the repository name and a description as shown in the following screenshot and click Create.

3) It may take a few minutes to create a repository. You will use https to connect your local GIT repository on your laptop to the GIT repository in Developer Cloud Service 4) To get the URL to access the GIT Repository in Developer Cloud Service, Click the HTTP tab in the BlackJack-Part2Repo home page 5) When you click on the HTTP tab, it will then display the HHTP. Click on the icon on the far right to copy the URL to Clipboard. Here is an example of what will be in Clipboard. https://susan.jang%40oracle.com@developer.em2.oraclecloud.com/developer34358- ouopc083/s/developer34358-ouopc083_blackjackproj_4583/scm/blackjackprojrepo.git

VII) Cloning a GIT Repository Clone the BlackJackProj project to a GIT repository on Developer Cloud Service Your goal is to clone the BlackJackProj project on your local machine to the GIT repository on Developer Cloud Service. But first, you need to clone the empty GIT repository from Developer Cloud Service to the local machine, the VM 1) Launch Git Bash from the icon on the Desktop. Note: Git needs to connect to the internet so to get to Developer Cloud Service. If you are connecting to internet on a proxy server, you need provide Git the proxy address of the proxy server. HTTP Proxy is basically a web address you type in to your company s proxy server so you can access the internet. 2) Set https proxy in Git export https_proxy=https://ges-proxy.us.oracle.com:80/ 3) In Git, go to the cloud directory cd cloud 4) Create a new directory for the Blackjack repository mkdir Blackjack 5) Change to the Blackjack directory - cd Blackjack 6) Confirm you are in the Blackjack directory cloud/blackjack - pwd You should see - /d/users/administrator/cloud/blackjack

7) Get the http url from the previous lab - Creating a GIT Repository in Developer Cloud Service, step #5 8) Clone the DevCS repository to your local git repository Execute `git clone <the http url from DevCS> Example: git clone https://susan.jang%40oracle.com@developer.em2.oraclecloud.com/developer34358- ouopc083/s/developer34358-ouopc083_blackjackproj_4583/scm/blackjackprojrepo.git Note: You will be prompt for your Cloud account password. If you are not prompted for user name and password and the command fails with a 403 error, then provide the password explicitly in the GIT repository URL. 9) Notice that there is a new directory named BlackjackProjRepo created inside cloud/blackjack directory. 10) Change to the BlackjackProjRepo directory - cd BlackjackProjRepo

In the BlackjackProjRepo directory, take the files in the blackjack-part2 directory (Scr Source code for Blackjack, Manifest.json Configuration file for deploying to OACCS, and Pom.xml plugs in for Maven) and copy it into the local git repository. Recall this directory got created when you extracted blackjack.zip 11) Copy and paste blackjack-part2 project directory from cloud/blackjack directory to BlackJackProjRepo directory cp -r /d/users/administrator/desktop/cloud/blackjack/blackjack-part2. (Don t forget the period at the end). 12) Note the contents in directory BlackJack-Part2Repo 13) Add the source files to GIT from project root directory - git add.

14) Commit the changes of the additional source files to the repository - git commit m Committing changes to BlackJackProjRepo repository 15) Push the files to the repository on Developer Cloud Service - git push origin master Wait until all the files are pushed to repository 16) Switch to Developer Cloud Service to verify the files pushed to the repository 17) In the BlackJackProj home page, click on BlackJackProjRepo.git

18) Notice that Blackjackproj project directory has been pushed to repository on Developer Cloud Service. Click on it and see its contents. The contents on the local server, is in the local repository. The contents in the local repository is now in the git repository in Developer Cloud Service

VIII) Building a Project on Developer Cloud Service Build the BlackJackProj project in Developer Cloud Service. 1) In the left navigation pane, click on Build and then New Job. (To bring up the left panel, click on the 3 horizontal gray lines next to Oracle Developer Cloud Services 2) In the New Job window, enter BlackJackProjBuildJob in the job name field, and click on Save. 3) On the Configure Job page a. In the Main tab, enter the following values i. Edit the job name (BlackJackProjBuildJob). ii. Enter a description (Job for Blackjack Proj Build) iii. Set the JDK to JDK 8.

b. Click the Source Control tab i. Select Git as your repository. ii. For Repositories, in the drop down, select BlackjackProjRepo.git c. Click the Triggers tab i. Check Based on SCM polling schedule Note: This setting will enable auto-deploy feature of DevCS. After the application is modified, if changes are committed to GIT repository on DevCS, it will automatically pick up the updated code and deploy it. d. Click the Build Steps tab. i. Click Add Build Step and select Invoke Maven 3. ii. Set the Goals to: clean package. iii. Set the POM File location to: blackjack-part2/pom.xml

e. Click the Post Build tab. i. Check Archive the artifacts. ii. iii. iv. Set Files To Archive to: blackjack-part2/target/blackjack-part2-1.0.jar, blackjack-part2/target/blackjack-part2-1.0-dist.zip Set Compression Type to NONE. Click Save 7) Click Build Now to start the job to begin the application in the Cloud.

If the build was successful, you'll see two files: blackjack-part2/target/blackjack-part2-1.0.jar and blackjack-part2/target/blackjack-part2-1.0-dist.zip in the Artifacts of Last Successful Build section. You can download them if you ever next the files by clicking the file name. If the build fails, then go back to check the build job configuration, or click Git Logs to see more information about the error. Great work! You took the application, the Blackjack game console, and deployed on the local server You then took what you deployed locally, and now build it into the cloud with Oracle Developer Cloud Service. Next you will take what you build in the Cloud with Developer Cloud Service (DevCS) and deploy the Blackjack application to Oracle Application Container Cloud Service (OACCS)

IX) Deploying a Project to OACCS from DevCS Deploy BlackJackProj to Application Container Cloud Service from Developer Cloud Service. 1) On the BlackjackProj, home page, in the left navigation pane, click on Deploy and then New Configuration 2) In the New Deployment Configuration page, enter the Configuration Name and Application Name 3) In the Deployment Target field, click New and select Application Container Cloud

4) In the Deploy to Application Container Cloud window a. Enter (Data center, Identity Domain, Username, Password) with the credentials you received. b. click Test connection c. When you see the Successful message, click Use Connection d. ACCS Properties i. Runtime: Java ii. Subscription: Monthly iii. Type: Automatic (Select Deploy stable build only) iv. Job: BlackJackProjBuildJob v. Artifact: blackjack-part2/target/blackjack-part2-1.0-dist.zip vi. Click Save 5) Click the gear icon and then select Start to deploy the application to Oracle Application Container Cloud Service. 6) After the successful deployment, right-click on BlackjackProj project name and copy the URL

X) Testing the BlackJack Application Deployed to OACCS from DevCS An HTML-5 client application has been developed and supplied with the BlackJack application to test its functionality once deployed. Use the following instructions to test the BlackJack application. 1) Open a graphical file explorer and navigate to the Cloud > BlackJack > html5-client directory. 2) Open the index.html file with a browser. (file:///d:/users/administrator/desktop/cloud/blackjack/html5-client/index.html) a. Make sure that the first field, Service, is populated with the URL you copied in step 6 of the previous exercise, (https://blackjackdev2oaccs-ouopc083.apaas.em2.oraclecloud.com/ b. Enter a number between 1 and 9 in the second field, and then click Connect. 3) Once you connect to the gaming console, click the Debug on/off button to view the Debug console. You can use the Hit and Stand buttons available on the UI to play the game like before. Congratulations! You have deployed your application to the Oracle Cloud. Now you can access your Blackjack gaming console from anywhere you have internet access! You can continue with the Hands-On Lab session and deploy the BlackJack application directly on the Application Cloud Service.

Deploy the BlackJack WebService App Directly to Oracle Application Container Cloud Overview This lab guides you through deploying the BlackJack application archive that you created in the previous lab to the Oracle Application Container Service on the cloud. Learning Objectives In this Hands-On Lab, you will learn how to: Deploy the application to the Application Container Service. Obtain the cloud service URL that points to where your application is deployed. Run the application you deployed with Oracle Application Container Service on the cloud Prerequisites Completion of the following labs: Preparing the environment for Building and Deploying Applications Test, Build and Deploy the BlackJack Web Service App I) Logging into Oracle Cloud account You will need your Oracle Cloud account credentials for this lab. 1) Follow the same instructions you use in the previous lab to log into your Oracle account. II) Direct Deployment of BlackJack Application to Oracle Application Container Cloud Service (OACCS) You will deploy an application archive to OACCS directly. You will use the same sample application, the BlackJack application for this deployment. Oracle Application Container Cloud Service can deploy and run Java Platform, Standard Edition (Java SE), and Node.js applications.

Deploy the BlackJack application to OACCS directly. 1) On Dashboard page, go to Application Container, click on the menu button, click the Open Service Console button 2) Click the Create Application button, it will open the Create Application window, and click the Java SE icon.

3) In the Create Application dialog box a. Enter Blackjack-OACCS for the application name b. Select Monthly for the subscription type. c. For the Application Archive field, select Upload Archive. d. Click Browse

e. Select the blackjack-part2-1.0-dist.zip file from the target directory f. Enter Deploying BlackJack Application to ACCS directly in the Notes field.

g. The Create Application dialog box now shows i. The selected file. ii. Under Instance, review the number of instances and the memory size h. Click Create to deploy your application to Oracle Application Container Cloud. 4) A status message appears indicating that it is Processing Archive. 5) It will take several minutes to deploy the application. The deployment status can be viewed under the In-Progress Activity section.

6) Once the application has been deployed successfully. You will not see the In Progress Activity section Copy the application URL and paste it in a notepad. We will need this URL for testing purposes.

III) Testing the BlackJack Application Deployed on OACCS An HTML-5 client application has been developed and supplied with the BlackJack application to test its functionality once deployed. 1) Open a graphical file explorer and navigate to the Cloud >BlackJack > html5-client directory. 2) Open the index.html file with a browser. 3) Make sure that the first field, Service is populated with the URL you copied in the previous exercise, < https://blackjack-oaccs-ouopc083.apaas.em2.oraclecloud.com/> Enter a number between 1 and 9 in the second field, and then, click Connect. 4) Once you connect to the gaming console, click the Debug on/off button to view the Debug console You can use the Hit and Stand buttons available on the UI to play the game. This HTML5 Client application interacts with the BlackJack gaming application deployed on OACCS in the cloud.

Congratulations! You have successfully completed deploying BlackJack application to OACCS directly using its user interface and testing. Now that you have completed the cloud-based labs for this event, you can optionally continue with the HelloWorld application and learn how to integrate a local development environment with a cloud environment.

Prerequisites Appendix A (optional): Test and Build Helloworld App using Oracle Developer Cloud Service This lab can be performed prior to performing the DevCS labs if you are working on your local machine. However, if you are at the Oracle Code Event, then this lab should be optionally performed after doing the cloud-based labs in order to maximize your time on the cloud. If you are performing this lab on the remote VM supplied by the Oracle Code Event, then your environment has already been set up for you and you can skip this prerequisite section If you want to set up this environment on your local machine to experiment afterwards, then follow the instructions for setting up your environment: o Windows Setup: Labs-local-windows-setup.md o Mac Setup: Labs-local-mac-setup.md Overview This lab guides you through the steps used to configure a local development environment to build, deploy, and test a HelloWorld application with the git, Maven, and NetBeans development tools. Additionally, you learn how to configure a replication service in the Oracle Developer Cloud Service and build, deploy, and test a HelloWorld application on the cloud. Learning Objectives You will learn how to: Configure and clone a Git repository Create a Maven project for a HelloWorld application Configure a Maven pom.xml file to use plugins to configure, build, and run the HelloWorld application locally Use Git source code control to version control your HelloWorld source files and clone them to a Git repository on the cloud Create and configure a Developer Cloud Service project to build, deploy, and run the HelloWorld application on the cloud I) Creating a GIT Repository As part of this activity, you will learn to create and initialize a local GIT repository. If you are using the environment provided by Oracle University, this has been done for you. If you wish to do this locally on your machine, please follow the instructions in the Creating a GIT Repository and Configuring a GIT Repository in a previous sections in this document.

II) Creating a Project with Maven Archetypes Use the following instructions to create a Maven project using Archetypes. 1) Open a graphical file explorer, navigate Desktop> Cloud 2) Create a Helloworld directory in Desktop> Cloud 3) Copy Helloworld-Eample.zip from >Desktop>HOL lab files to >Desktop>Cloud>Helloworld, and extract the zip file into the Helloworld directory 4) Launch Git Bash. If you closed the Git Bash window, remember you must set proxy with - export https_proxy=https://ges-proxy.us.oracle.com:80/ 5) In the Git Bash window, change to the cloud directory where your Git repository is stored. - cd cloud 6) Create a Helloworld directory in >Desktop>Cloud mkdir Helloworld 7) Change to the Helloworld directory - cd Helloworld 8) Create an empty Maven project using the maven-archetype-quickstart archetype. Enter the following command: mvn archetype:generate -DgroupId=com.example -DartifactId=Helloworld-Example - DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false Note: The output of this command will look like this: The command creates an empty Maven project named Helloworld-Example. Examine the directory structure and note that an executable class is located at com.example.app.

The pom.xml file must be configured for plug-ins. Launch Notepad++ open the pom.xml file in the HOL Lab files directory. Review the content of the file. 9) Launch Netbeans using the shortcut on the desktop. 10) Open the Helloworld-Example project created under Cloud/Helloworld directory in Netbeans. D:\Users\Administrator\Cloud\Helloworld\Helloworld-Example 11) Examine the directory structure of the project, open com.example.app executable class, and review the code.

12). Right-click the Project Files > pom.xml file and click Open. Note: Steps 13 through 17 defines the things you need to add to the pom.xml. You can use the pom.xml file in the HOL Lab files directory you opened in Notepad++. Select the entire xml file, copy it, and paste it to replace all the content of the pom.xml in the source window Or You can go through each of the step and add to the current content of the pom.xml in the source window. 13) Add the following properties settings to the file before the dependencies section. This sets the Java version and encoding for the project. <properties> <java.version>1.8</java.version> <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> 14) After the dependencies element, add elements for build and plug-ins. <build> <plugins> <!-- Your plugins go here --> </plugins> </build>

15) Add the configuration for the compiler plug-in to the plug-ins section. <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> 16) Add the exec plug-in to the pom.xml file. <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.4.0</version> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <mainclass>com.example.app</mainclass> </configuration> </plugin> 17) Add the JAR plug-in to the pom.xml file. <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <version>2.6</version> <configuration> <archive> <manifest> <mainclass>com.example.app</mainclass> </manifest> </archive> </configuration> </plugin>

18) In the source window, right-click the pom.xml file and select Format to fix the indentation for the file. 19) Save the pom.xml file. If you might see an issue, follow instructions on how to Resolve from the previous labs. 20) Right-click the Helloworld-Example project and click Clean and Build.

When see Build Success in Output Window, then Run 21) Right-click the Helloworld-Example project and click Run. 22) Select com.example.app from the Available Main Classes list and click the Select Main Class button. 23) You should see Hello World! Output with a BUILD SUCCESS message. 24) Switch to Git Bash and change the directory to Helloworld-Example - cd Helloworld-Example 25) Execute the mvn clean compile command to clean and compile the project.

When the compilation is completed you will see the target directory 26) Execute the mvn exec:java command to execute the application.command to package the application. 27) Execute the mvn package command to package the application.

Note: Examine the Helloworld-Example-1.0-SNAPSHOT.jar file created inside cloud/helloworld/helloworld-example/target directory. 28) Execute the java -jar target/helloworld-example-1.0-snapshot.jar command to run the packaged application. You executed the Helloworld application to have Hello World! display on your screen.

III) Checking the Helloworld-Example Project into a GIT Repository Use the following instructions to store the Helloworld-Example project in the local GIT repository. 1) Change into the cloud/helloworld directory. 2) Execute the git add n. command to see the list of files that are ready to be added to the repository. Note: Please notice that there is. at the end of the command. 3) Execute the git add. command to add the files to the repository. 4) Execute the git status command to check the files that are added. 5) Execute the git commit m Initial Commit for Helloworld-Example Project to commit the files to the repository and begin version tracking.

6) Your files are now checked in for version tracking. 7) Check the status of the repository by executing the git status command. Note: You should get a response similar to the one in the screenshot. IV) Creating a Developer Cloud Service Project Use Developer Cloud Service to create an empty project (HelloworldProject) with a repository (HelloworldProjectRepo) to push the Helloworld-Example application that you have created in the previous activity to Developer Cloud Service. 1) Follow instructions from previous lab to log into your Oracle Cloud account, and Open Service Console in Developer Cloud Service. 2) Click New Project.

3) Enter the Project Name and Description as shown in the following screenshot and click Next. 4) Click the Empty Project template and Next.

5) Select MARKDOWN from the Wiki Markup drop-down list and click Finish. 6) Provisioning HelloworldProject may take several minutes. Wait until all the modules are provisioned and redirected to the HelloworldProject home screen.

V) Creating a GIT Repository in Developer Cloud Service Use the following instructions to create a GIT repository on Developer Cloud Service. 1) Click the New Repository button in the REPOSITORIES section. 2) In the New Repository window, enter the repository name and description as shown in the following screenshot and click Create. 3) It may take a few minutes to create a repository. Wait until the HelloworldProjectRepo repository is created and redirected to the HelloworldProjectRepo home page. 4) Click the HTTP tab in the HelloworldProjectRepo home page and copy the URL.

VI) Cloning a GIT Repository Use the following instructions to clone the Helloworld-Example project to a GIT repository on Developer Cloud Service. 2) To clone a GIT repository, first change to the cloud/helloworld directory that is the root directory for your repository. 3) Execute git clone https://cloud.admin@developer.us2.oraclecloud.com/developer97367- gse00003131/s/developer97367- gse00003131_helloworldproject_16312/scm/helloworldprojectrepo.gitgit Notes: Enter your cloud account username and password, if you are prompted. The output of this command should be similar to the output in the above screenshot. 4) Notice that there is a new directory named HelloworldProjectRepo created inside cloud/helloworld directory.

4) Copy and paste Helloworld-Example project directory from Cloud/Helloworld directory to HelloworldProjectRepo directory Note: Content of the HelloworldProjectRepo directory should match with the contents listed below screenshot. 5) Change to the HelloworldProjectRepo directory - cd HelloworldProjectRepo 6) Add the source files to GIT from project root directory - git add. 7) Commit the changes - git commit m commiting changes to HelloworldProjectRepo repository 8) Push the files to the repository on Developer Cloud Service - git push origin master 9) Switch to Developer Cloud Service to verify the files pushed to the repository 10) In the HelloworldProject home page, click on HelloworldProjectRepo.git 11) Notice that Helloworld-Example project directory has been pushed to repository on Developer Cloud Service..

12) Click on it and verify its contents VII) Cloning a GIT RepositoBuilding a Project on Developer Cloud Servicery Use the following instructions to build Helloworld-Example project Developer Cloud Service. 1) In the left navigation pane, click on Build and then New Job 2) In the New Job window, enter HelloworldProjectBJ the job name field and click on Save

3) In the Main tab, enter the following values: a) Edit the job name if it needs adjusting. b) Enter a description. c) Set the JDK to JDK 8. 4) Click the Source Control tab a) Select Git as your repository. b) For URL, select the URL to your Git repository.

5) Click the Build Steps tab. a) Click Add Build Step and select Invoke Maven 3. b) Set the Goals to: clean package. c) Set the POM File location to: Helloworld-Example/pom.xml

6) Click the Post Build tab. a) Select Archive the artifacts. b) Set Files To Archive to: Helloworld-Example/target/Helloworld-Example-1.0-SNAPSHOT.jar c) Set Compression Type to NONE. 7) Click Save and then click Build Now. If the build was successful, you'll see a file: Helloworld-Example/target/Helloworld-Example-1.0- SNAPSHOT.jar in the Artifacts of Last Successful Build section. You can download it by clicking the file name. If the build failed then go back to check the build job configuration or click Git Logs to see more information about the error. With this you have successfully completed creating a local GIT repository, creating a Maven project, storing Maven project in local GIT repository, activating DevCS, creating a project and GIT repository in DevCS, cloning project to DevCS and then creating a build job for deployment.