[ 
https://issues.apache.org/jira/browse/BEAM-4838?focusedWorklogId=125962&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-125962
 ]

ASF GitHub Bot logged work on BEAM-4838:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Jul/18 10:15
            Start Date: 23/Jul/18 10:15
    Worklog Time Spent: 10m 
      Work Description: lgajowy commented on a change in pull request #5989: 
[BEAM-4838] Add dockerfile for standalone Jenkins. Plugins included.
URL: https://github.com/apache/beam/pull/5989#discussion_r204331738
 
 

 ##########
 File path: devtools/JenkinsOnDocker/README.md
 ##########
 @@ -0,0 +1,165 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+# Local Jenkins Setup
+
+Setting up a local Jenkins instance is useful for testing Jenkins job changes
+without affecting the production instance. Using Docker makes the setup very
+straightforward.
+
+## Jenkins on Docker
+
+### Requirements
+If you haven't yet, [install Docker on your 
machine.](https://docs.docker.com/install/)
+
+
+### Setup using provided scripts
+
+**WARNING: Not for production use.**
+
+*INFO: Changing admin credentials is advised.*
+
+You can utilize scripts in this folder to build Docker container with Jenkins,
+pre-installed plugins and some basic configuration.
+
+```bash
+docker build -t beamjenkins .
+docker run -p 127.0.0.1:8080:8080 beamjenkins:latest
+```
+* plugins.txt -- Pre-assembled list of plugins that are available on Apache
+  Jenkins. This list does not contain versions and might not have all the
+  plugins available. If you find some plugin missing, or having and incorrect
+  version, you can check
+  [infra wiki 
list](https://cwiki.apache.org/confluence/display/INFRA/Jenkins+Plugin+Upgrades)
+  for plugin updates history. Feel free to update this list with added/removed
+  plugins.
+* docker build -- builds image with name beamjenkins based on Dockerfile 
located
+  in current folder.
+* docker run -- creates and starts new container.
+    * The `-p 127.0.0.1:8080:8080` parameter to `docker run` ensures that your
+      Jenkins instance will only be available via localhost and not your 
machine
+      hostname.
+* Default credentials: admin:jenadmin (Suggested to change these in 
Dockerfile.)
+
+Image built via this scripts will contain all required plugins, basic
+configuration listed in manual setup instructions below and also remap
+JENKINS_HOME, so it does not map to a volume, but is part of container instead.
+
+This last action will allow you to persist changes you do to your container:
+
+```bash
+docker ps -a
+docker commit <container_id> <new_image_name>
+docker run -p 127.0.0.1:8080:8080 <new_image_name>
+```
+* docker ps -- list containers.
+* docker commit -- creates new image based on container.
+
+Such approach may be handy for debugging, but it is highly advised to keep all
+data in docker volumes.
+
+### Manual setup
+
+When invoking Docker, you can map a local directory to persist state and keep
+your Jenkins configuration even after machine reboot. //TODO This is planned to
+change to explaining how to spin up data container.
+
+```bash
+JENKINS_HOME=$(readlink --canonicalize-missing ~/jenkins/homedir)
+
+mkdir --parents ${JENKINS_HOME}
+chmod --recursive 777 ${JENKINS_HOME}
+docker run -p 127.0.0.1:8080:8080 -v ${JENKINS_HOME}:/var/jenkins_home 
jenkins/jenkins:lts
+```
+
+Running this command will bring up your Jenkins instance at
+http://127.0.0.1:8080. And map jenkins_home of running container to 
JENKINS_HOME
+on your OS file system.
+
+You can setup your Jenkins instance to look like the Apache Beam Jenkins using
+[these steps](#beam-config).
+
+//TODO Change 777 permissions, to minimum required set.
+
+#### Forking your Jenkins instance
+
+Later you can fork a new Docker container by copying the contents of the mapped
+directory and starting Jenkins from the new copy.
+
+This might be useful in case if you want to test new plugins/configuration and
+want to have a clean roll-back option.
+
+```bash
+JENKINS_NEWHOME=$(readlink --canonicalize-missing ~/jenkins/homedir_v2)
+
+mkdir --parents ${JENKINS_NEWHOME}
 
 Review comment:
   ditto

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 125962)
    Time Spent: 2h 40m  (was: 2.5h)

> Prepare instructions for running Jenkins locally.
> -------------------------------------------------
>
>                 Key: BEAM-4838
>                 URL: https://issues.apache.org/jira/browse/BEAM-4838
>             Project: Beam
>          Issue Type: Improvement
>          Components: build-system
>            Reporter: Mikhail Gryzykhin
>            Assignee: Mikhail Gryzykhin
>            Priority: Major
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> We need a way to test Jenkins Job DSL scripts without breaking our build 
> server. One of the approaches available is to spin up Jenkins on your local 
> machine with all plugins available.
> This has already been used by some developers in their workflow.
> We want to share instruction on spinning up local Jenkins with other 
> developers.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to