{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/76286667","id":76286667,"diff_hunk":"@@ -0,0 +1,218 @@\n+# OpenShift + Maven Tutorial\n+\n+While developing your application with Java, you'll most likely be building\n+many, many, many times.  In order to shorten the build times of your pods,\n+dependencies can be cached in local Maven repositories.  This tutorial will step\n+you through integrating a Maven repository into your project.\n+\n+| Content: |\n+|:----------------------------|\n+|[Prerequisites](#prerequisites)|\n+|[Setting up Nexus](#setting-up-nexus)|\n+|[Modifying the Builder](#modifying-the-builder)|\n+|[See Also](#see-also)|\n+\n+## Prerequisites\n+\n+This tutorial assumes that you'll be working with a project that is already set\n+up for use with Maven.  If you're interested in using Maven with your Java\n+project, we highly recommend looking at\n+[their guide](https://maven.apache.org/guides/getting-started/index.html).\n+\n+## Setting up Nexus\n+\n+Download the official Nexus Docker image and use `new-app` to deploy it.\n+```bash\n+docker pull sonatype/nexus\n+oc new-app sonatype/nexus\n+```\n+\n+After the build has finished, run:\n+```bash\n+oc get svc\n+```\n+\n+The output should look resemble:\n+```bash\n+NAME      CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE\n+nexus     172.30.170.249   <none>        8081/TCP   6s\n+```\n+\n+Confirm that Nexus is running by navigating your browser to the new Cluster-IP\n+at port 8081.  The server may take a bit of time to start, be patient!\n+\n+> NOTE: Nexus comes pre-configured for the Central Repository, but you may need others\n+> for your application.  At this point, add any special repositories to Nexus.\n+\n+Now we'll create a Persistant Volume for Nexus, so that our dependencies will\n+not be lost with the Pod.  If you do not have admin access on your cluster, ask\n+your system administrator to create a Read/Write Persistant Volume for your, and\n+move to the creating a Persistant Volume Claim.\n+\n+> NOTE: If you don't want persistant storage, continue to\n+> [Modifying the Builder](#modifying-the-builder).  However, your cached\n+> dependencies will be lost with the pod.\n+\n+Create a directory on your host machine that will be writable by OpenShift.\n+```bash\n+mkdir /tmp/nexus-pv\n+chmod 777 /tmp/nexus-pv\n+```\n+\n+Log in to your admin user, if necessary.  Using `oc cluster up`, this is done\n+with:\n+```bash\n+oc login -u system:admin\n+```\n+\n+Create a file called `pv.json` with the following content:\n+```json\n+{\n+\t\"apiVersion\": \"v1\",\n+\t\"kind\": \"PersistentVolume\",\n+\t\"metadata\": {\n+\t\t\"name\": \"nexus-pv\",\n+\t\t\"labels\": {\n+\t\t\t\"type\": \"local\"\n+\t\t}\n+\t},\n+\t\"spec\": {\n+\t\t\"hostPath\": {\n+\t\t\t\"path\": \"/tmp/nexus-pv\"\n+\t\t},\n+\t\t\"accessModes\": [\n+\t\t\t\"ReadWriteOnce\"\n+\t\t],\n+\t\t\"capacity\": {\n+\t\t\t\"storage\": \"1Gi\"\n+\t\t},\n+\t\t\"persistentVolumeReclaimPolicy\": \"Retain\"\n+\t}\n+}\n+```\n+\n+Import that file into OpenShift.\n+```bash\n+oc create -f pv.json\n+```\n+\n+Log back in to your user, then add a Persistent Volume Claim to the Nexus\n+Deployment Config.  Using `oc cluster up`, the default user is 'developer'\n+```bash\n+oc login -u developer\n+oc volumes dc/nexus --remove --confirm\n+oc volumes dc/nexus --add \\\n+\t--name 'nexus-pvc' \\\n+\t--type 'pvc' \\\n+\t--mount-path '/sonatype-work/' \\\n+\t--claim-name 'nexus-pv' \\\n+\t--claim-size '1G'\n+```\n+\n+This removes the previous volume for the Deployment Config, and adds a claim\n+for 1 gigabyte of storage mounted at `/sonatype-work`, which is where our\n+dependencies will be stored.  Due to the change in config, the Nexus image will\n+be redeployed automatically.\n+\n+Verify that Nexus is running by refreshing the Nexus page in your browser.\n+\n+## Modifying the Builder\n+\n+The next steps will be modifying our builder image to use this repository.\n+The rest of the tutorial will be editing\n+[this sample repository](https://github.com/bparees/openshift-jee-sample.git),\n+but these changes should work for any project.\n+\n+Create a directory in your project called 'wildfly-builder'.  Inside this\n+direcotry, create a file in your project called `settings.xml` with the\n+following content:\n+```xml\n+<settings>\n+  <mirrors>\n+    <mirror>\n+      <!--This sends everything else to /public -->\n+      <id>nexus</id>\n+      <mirrorOf>*</mirrorOf>\n+      <url>http://nexus:8081/content/groups/public</url>\n+    </mirror>\n+  </mirrors>\n+  <profiles>\n+    <profile>\n+      <id>nexus</id>\n+      <!--Enable snapshots for the built in central repo to direct -->\n+      <!--all requests to nexus via the mirror -->\n+      <repositories>\n+        <repository>\n+          <id>central</id>\n+          <url>http://central</url>\n+          <releases><enabled>true</enabled></releases>\n+          <snapshots><enabled>true</enabled></snapshots>\n+        </repository>\n+      </repositories>\n+     <pluginRepositories>\n+        <pluginRepository>\n+          <id>central</id>\n+          <url>http://central</url>\n+          <releases><enabled>true</enabled></releases>\n+          <snapshots><enabled>true</enabled></snapshots>\n+        </pluginRepository>\n+      </pluginRepositories>\n+    </profile>\n+  </profiles>\n+  <activeProfiles>\n+    <!--make the profile active all the time -->\n+    <activeProfile>nexus</activeProfile>\n+  </activeProfiles>\n+</settings>\n+```\n+\n+This is the crucial file for the effort.  We're telling Maven to use only the\n+repository at nexus:8081, which is our proxy.  More information on DNS\n+resolution in OpenShift can be found\n+[here](https://docs.openshift.com/enterprise/3.1/architecture/additional_concepts/networking.html)\n+\n+Create a Dockerfile in the wildfly-builder directory with a `FROM` entry that\n+points to the builder image you normally use.  Add a `COPY` entry pointing to\n+the `settings.xml` you created earlier.\n+\n+```\n+FROM docker.io/openshift/wildfly-100-centos7:latest\n+\n+COPY settings.xml /usr/share/maven/conf/settings.xml\n+COPY settings.xml /opt/app-root/src/.m2/settings.xml\n+```\n+\n+> NOTE: Maven's default global settings are in `/usr/share/maven/conf`, but some images\n+> specify a settings.xml file when it is called.  For example, our WildFly builder\n+> image uses `mvn -S /opt/app-root/src/.m2/settings.xml`, so we overwrite that\n+> file with our own.  You may have to do the same.","path":"docs/maven-tutorial.md","position":192,"original_position":188,"commit_id":"85855bfbe54c90b3e75c8def34dce9993349203c","original_commit_id":"0917a25a145a40aeca1b238eb500ce8e8c0d282e","user":{"login":"php-coder","id":87088,"avatar_url":"https://avatars.githubusercontent.com/u/87088?v=3","gravatar_id":"","url":"https://api.github.com/users/php-coder","html_url":"https://github.com/php-coder","followers_url":"https://api.github.com/users/php-coder/followers","following_url":"https://api.github.com/users/php-coder/following{/other_user}","gists_url":"https://api.github.com/users/php-coder/gists{/gist_id}","starred_url":"https://api.github.com/users/php-coder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-coder/subscriptions","organizations_url":"https://api.github.com/users/php-coder/orgs","repos_url":"https://api.github.com/users/php-coder/repos","events_url":"https://api.github.com/users/php-coder/events{/privacy}","received_events_url":"https://api.github.com/users/php-coder/received_events","type":"User","site_admin":false},"body":">We could overwrite the user settings, is there a way to get the $USER value in a pod from a Dockerfile?\r\n\r\nYou're using wildfly image as example, so I think that it will be enough to mention that in other cases $HOME dir can be different.\r\n\r\n>Or perhaps we could append the content to an existing one.\r\n\r\nNo, you can't because XML has a structure. You can merge them, but it's hard, especially automatically.","created_at":"2016-08-25T17:19:49Z","updated_at":"2016-08-25T17:19:49Z","html_url":"https://github.com/openshift/origin/pull/10645#discussion_r76286667","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/10645","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/76286667"},"html":{"href":"https://github.com/openshift/origin/pull/10645#discussion_r76286667"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/10645"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/10645","id":82750376,"html_url":"https://github.com/openshift/origin/pull/10645","diff_url":"https://github.com/openshift/origin/pull/10645.diff","patch_url":"https://github.com/openshift/origin/pull/10645.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/10645","number":10645,"state":"open","locked":false,"title":"Added a tutorial for setting up a Nexus service.","user":{"login":"oatmealraisin","id":6402382,"avatar_url":"https://avatars.githubusercontent.com/u/6402382?v=3","gravatar_id":"","url":"https://api.github.com/users/oatmealraisin","html_url":"https://github.com/oatmealraisin","followers_url":"https://api.github.com/users/oatmealraisin/followers","following_url":"https://api.github.com/users/oatmealraisin/following{/other_user}","gists_url":"https://api.github.com/users/oatmealraisin/gists{/gist_id}","starred_url":"https://api.github.com/users/oatmealraisin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oatmealraisin/subscriptions","organizations_url":"https://api.github.com/users/oatmealraisin/orgs","repos_url":"https://api.github.com/users/oatmealraisin/repos","events_url":"https://api.github.com/users/oatmealraisin/events{/privacy}","received_events_url":"https://api.github.com/users/oatmealraisin/received_events","type":"User","site_admin":false},"body":"The tutorial covers setting up containerized Nexus Repository for Maven\r\ndependency caching.\r\n\r\n@bparees ptal?\r\n\r\n[This is the card for this feature.](https://trello.com/c/X8xapGSH/703-3-document-setting-up-a-local-maven-proxy-evg)","created_at":"2016-08-25T16:19:08Z","updated_at":"2016-08-25T17:19:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c44c069b1561867df6694e0a796c8b6e75dcf7b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/10645/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/10645/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/10645/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/85855bfbe54c90b3e75c8def34dce9993349203c","head":{"label":"oatmealraisin:rymurphy/maventutorial","ref":"rymurphy/maventutorial","sha":"85855bfbe54c90b3e75c8def34dce9993349203c","user":{"login":"oatmealraisin","id":6402382,"avatar_url":"https://avatars.githubusercontent.com/u/6402382?v=3","gravatar_id":"","url":"https://api.github.com/users/oatmealraisin","html_url":"https://github.com/oatmealraisin","followers_url":"https://api.github.com/users/oatmealraisin/followers","following_url":"https://api.github.com/users/oatmealraisin/following{/other_user}","gists_url":"https://api.github.com/users/oatmealraisin/gists{/gist_id}","starred_url":"https://api.github.com/users/oatmealraisin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oatmealraisin/subscriptions","organizations_url":"https://api.github.com/users/oatmealraisin/orgs","repos_url":"https://api.github.com/users/oatmealraisin/repos","events_url":"https://api.github.com/users/oatmealraisin/events{/privacy}","received_events_url":"https://api.github.com/users/oatmealraisin/received_events","type":"User","site_admin":false},"repo":{"id":60552506,"name":"origin","full_name":"oatmealraisin/origin","owner":{"login":"oatmealraisin","id":6402382,"avatar_url":"https://avatars.githubusercontent.com/u/6402382?v=3","gravatar_id":"","url":"https://api.github.com/users/oatmealraisin","html_url":"https://github.com/oatmealraisin","followers_url":"https://api.github.com/users/oatmealraisin/followers","following_url":"https://api.github.com/users/oatmealraisin/following{/other_user}","gists_url":"https://api.github.com/users/oatmealraisin/gists{/gist_id}","starred_url":"https://api.github.com/users/oatmealraisin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oatmealraisin/subscriptions","organizations_url":"https://api.github.com/users/oatmealraisin/orgs","repos_url":"https://api.github.com/users/oatmealraisin/repos","events_url":"https://api.github.com/users/oatmealraisin/events{/privacy}","received_events_url":"https://api.github.com/users/oatmealraisin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/oatmealraisin/origin","description":"OpenShift - Build, deploy, and manage cloud-native and legacy applications with Kubernetes and Docker","fork":true,"url":"https://api.github.com/repos/oatmealraisin/origin","forks_url":"https://api.github.com/repos/oatmealraisin/origin/forks","keys_url":"https://api.github.com/repos/oatmealraisin/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oatmealraisin/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oatmealraisin/origin/teams","hooks_url":"https://api.github.com/repos/oatmealraisin/origin/hooks","issue_events_url":"https://api.github.com/repos/oatmealraisin/origin/issues/events{/number}","events_url":"https://api.github.com/repos/oatmealraisin/origin/events","assignees_url":"https://api.github.com/repos/oatmealraisin/origin/assignees{/user}","branches_url":"https://api.github.com/repos/oatmealraisin/origin/branches{/branch}","tags_url":"https://api.github.com/repos/oatmealraisin/origin/tags","blobs_url":"https://api.github.com/repos/oatmealraisin/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oatmealraisin/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oatmealraisin/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/oatmealraisin/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oatmealraisin/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/oatmealraisin/origin/languages","stargazers_url":"https://api.github.com/repos/oatmealraisin/origin/stargazers","contributors_url":"https://api.github.com/repos/oatmealraisin/origin/contributors","subscribers_url":"https://api.github.com/repos/oatmealraisin/origin/subscribers","subscription_url":"https://api.github.com/repos/oatmealraisin/origin/subscription","commits_url":"https://api.github.com/repos/oatmealraisin/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/oatmealraisin/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/oatmealraisin/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/oatmealraisin/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/oatmealraisin/origin/contents/{+path}","compare_url":"https://api.github.com/repos/oatmealraisin/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oatmealraisin/origin/merges","archive_url":"https://api.github.com/repos/oatmealraisin/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oatmealraisin/origin/downloads","issues_url":"https://api.github.com/repos/oatmealraisin/origin/issues{/number}","pulls_url":"https://api.github.com/repos/oatmealraisin/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/oatmealraisin/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/oatmealraisin/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oatmealraisin/origin/labels{/name}","releases_url":"https://api.github.com/repos/oatmealraisin/origin/releases{/id}","deployments_url":"https://api.github.com/repos/oatmealraisin/origin/deployments","created_at":"2016-06-06T18:47:57Z","updated_at":"2016-06-06T18:48:05Z","pushed_at":"2016-08-25T17:12:26Z","git_url":"git://github.com/oatmealraisin/origin.git","ssh_url":"git@github.com:oatmealraisin/origin.git","clone_url":"https://github.com/oatmealraisin/origin.git","svn_url":"https://github.com/oatmealraisin/origin","homepage":"http://www.openshift.org","size":319761,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"b19839883ebd3f22d9347feff63af26d6b43291e","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"Enterprise-Ready Kubernetes for Developers","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/origin/deployments","created_at":"2014-07-30T20:04:05Z","updated_at":"2016-08-25T08:19:32Z","pushed_at":"2016-08-25T17:13:09Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":571806,"stargazers_count":1629,"watchers_count":1629,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1029,"mirror_url":null,"open_issues_count":1088,"forks":1029,"open_issues":1088,"watchers":1629,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/10645"},"html":{"href":"https://github.com/openshift/origin/pull/10645"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/10645"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/10645/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/10645/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/10645/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/85855bfbe54c90b3e75c8def34dce9993349203c"}}}}
{"actor":{"display_login":"php-coder"}}