<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[finoit - Medium]]></title>
        <description><![CDATA[Solving Business Problems with Technology - Medium]]></description>
        <link>https://medium.com/finoit?source=rss----3163d5ccc23c---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>finoit - Medium</title>
            <link>https://medium.com/finoit?source=rss----3163d5ccc23c---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 18:07:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/finoit" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Docker Questions and Exercises]]></title>
            <link>https://medium.com/finoit/docker-questions-and-exercises-4b36a7f8291?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/4b36a7f8291</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-container]]></category>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[docker-compose]]></category>
            <dc:creator><![CDATA[Ankur Parashar]]></dc:creator>
            <pubDate>Tue, 29 Nov 2022 15:49:13 GMT</pubDate>
            <atom:updated>2023-01-05T07:17:34.333Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*Xq3zBJ8TjesDMXXDLcdpgg.png" /></figure><p>The objective of all these questions is to bring docker in hand on practice.</p><p>Which of the following statements about VMs and Docker containers are not valid?</p><blockquote>a. Virtual Machine contains the entire Operating System.</blockquote><blockquote>b. Docker containers use the resource of the host operating system.</blockquote><blockquote>c. Docker containers are used when multiple applications need to run on the same host.</blockquote><blockquote>d. Virtual Machine and Docker Containers are the same thing.</blockquote><p>Which of the following are true about Container creation from docker image?</p><blockquote>a. Each Docker container is assigned a universally unique identifier (UUID).</blockquote><blockquote>b. Container creation, Docker allows us to set container names using the name flag.</blockquote><blockquote>c. If you do not specify the Container name, docker supplies a randomly-generated name from two words, joined by an underscore.</blockquote><p>Which of the following are advantages of Container Orchestration?</p><blockquote>a. Scaling up or removing containers to spread application load</blockquote><blockquote>b. Movement of containers from one resource to another</blockquote><blockquote>c. Load balancing of service discovery between containers</blockquote><blockquote>d. Health monitoring of containers and hosts</blockquote><p>Choose the correct statements for the following command. — — — — — “docker image prune”</p><blockquote>a. command allows us to clean up unused images.</blockquote><blockquote>b. By default, the above command will only clean up dangling images.</blockquote><blockquote>c. Dangling Images are Image without Tags and Image not referenced by any container</blockquote><blockquote>d. All of the above</blockquote><p>Which of the following is not a valid docker CLI command?</p><blockquote>a. docker image build</blockquote><blockquote>b. docker image history</blockquote><blockquote>c. docker image import</blockquote><blockquote>d. docker image inspect</blockquote><blockquote>e. docker image delete</blockquote><p>What is the default Network Type in Docker?</p><blockquote>a. bridge</blockquote><blockquote>b. host</blockquote><blockquote>c. overlay</blockquote><blockquote>d. macvlan</blockquote><p>Which of the following is not a valid Docker Instruction?</p><blockquote>a. FROM</blockquote><blockquote>b. RUN</blockquote><blockquote>c. CMD</blockquote><blockquote>d. LABEL</blockquote><blockquote>e. ADJUST</blockquote><p>Which of the following is not a valid docker CLI command?</p><blockquote>a. docker image build</blockquote><blockquote>b. docker image history</blockquote><blockquote>c. docker image import</blockquote><blockquote>d. docker image inspect</blockquote><blockquote>e. docker image delete</blockquote><p>Choose the incorrect statements from the following.</p><blockquote>a. Multiple containers can be started using the same image.</blockquote><blockquote>b. Docker Image is immutable</blockquote><blockquote>c. Docker Container has a Top Layer which is writable</blockquote><blockquote>d. Docker Container and Docker Images are the same thing</blockquote><p>Which of the following flag is not valid while using HEALTHCHECK instruction?</p><blockquote>a. interval=DURATION</blockquote><blockquote>b. timeout=DURATION</blockquote><blockquote>c. start-period=DURATION</blockquote><blockquote>d. retries=N (default: 3)</blockquote><blockquote>e. All are valid</blockquote><p>Pick the default docker container restart policy.</p><blockquote>a. none</blockquote><blockquote>b. always</blockquote><blockquote>c. on-failure</blockquote><blockquote>d. unless-stopped</blockquote><p>Which of the following commands are correct?</p><blockquote>a. docker exec -it service-a bash</blockquote><blockquote>b. docker run -it service-a sh</blockquote><blockquote>c. docker run — env VAR1=value1 — env VAR2=value2 ubuntu env</blockquote><blockquote>d. All of the above.</blockquote><p>Which of the following namespace is not enabled by default?</p><blockquote>a. volume</blockquote><blockquote>b. network</blockquote><blockquote>c. pid</blockquote><blockquote>d. user</blockquote><p>Write the docker commands to perform the following:</p><blockquote>List all docker images</blockquote><blockquote>List all running docker containers</blockquote><blockquote>List all containers which are in exited state</blockquote><blockquote>Tag a docker image</blockquote><blockquote>Push an image to docker repository</blockquote><blockquote>List all dangling images</blockquote><blockquote>Delete all dangling images</blockquote><p>What is the difference between below commands?</p><blockquote>docker rmi $(docker images -a — filter=dangling=true -q)</blockquote><blockquote>docker rmi $(docker images -f dangling=true -q)</blockquote><p>Which of the following instructions will optimise the size of the image and why?</p><blockquote>Instruction 1::</blockquote><blockquote>ADD <a href="https://mysite.com/abc.tar">https://mysite.com/abc.tar</a> /mnt/data</blockquote><blockquote>RUN tar -xJf /mnt/data/abc.tar /mnt/data</blockquote><blockquote>RUN make -C /mnt/data all</blockquote><blockquote>Instruction 2::</blockquote><blockquote>RUN mkdir -p /mnt/data \</blockquote><blockquote>&amp;&amp; curl -SL <a href="https://mysite.com/abc.tar">https://mysite.com/abc.tar</a> \</blockquote><blockquote>| tar -xJf /mnt/data \</blockquote><blockquote>&amp;&amp; make -C /mnt/data all</blockquote><p>Which of the following are true about Docker Secrets?</p><blockquote>a. Secret can be modified</blockquote><blockquote>b. Secret can only be excited on docker-swarm management console</blockquote><blockquote>c. Can’t renamed or update to docker secret</blockquote><p>By default docker container is privileged or unprivileged?</p><p>What is the difference between docker save and docker export commands?</p><p>Which flag will be used for automatically removing a Container?</p><p>Write a docker command to run a container with volume mounted as /mnt/mydata?</p><p>What is the difference between COPY and ADD commands?</p><p>What is the difference between CMD and ENTRYPOINT instruction?</p><p>What is the difference between docker filter and format commands?</p><p>Which file can customise the DNS settings of the container?</p><p>What is the difference between Limit and Reservation?</p><p>Please find the <a href="https://github.com/ankurparashar/Docker-Library">github</a> link for above resource, feel free to reach out to me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b36a7f8291" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/docker-questions-and-exercises-4b36a7f8291">Docker Questions and Exercises</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jenkins Migration to AWS Part-2]]></title>
            <link>https://medium.com/finoit/jenkins-migration-to-aws-part-2-eb3efce50d9a?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/eb3efce50d9a</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[backup-and-restore]]></category>
            <category><![CDATA[jenkins-pipeline]]></category>
            <category><![CDATA[jenkins-plugins]]></category>
            <dc:creator><![CDATA[Ankur Parashar]]></dc:creator>
            <pubDate>Tue, 16 Aug 2022 18:25:30 GMT</pubDate>
            <atom:updated>2022-08-17T02:42:07.603Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u-putJTCDwBvenMZ8SLEJg.png" /></figure><p>In the previous section we have successfully installed the Jenkins on Another machine, now it’s time to focus on our objectives.</p><p><strong>Objectives:</strong></p><ul><li>Transfer all existing projects/pipelines</li><li>Transfer all existing plugins</li><li>Transfer all configuration settings: System Global Tool, Security, Nodes, Credentials</li></ul><p><strong>Avoid the following:</strong> Don’t go for the shortcuts like Backup Manager, GbackUp, ThinPlugin etc… since they will not work either not due to different versions or will not cover all the mentioned objectives.</p><p><strong>Copy and Transfer Full Data:</strong></p><p># Zip the whole contents of JENKINS_HOME</p><blockquote>cd /home/ubuntu</blockquote><blockquote>sudo su</blockquote><blockquote>nohup zip -r jenkins-backup.zip /var/lib/jenkins &amp;</blockquote><p>Note: To reduce the size of backup file removed the old backups form /var/lib/jenkins/backup</p><p># Transfer the Zip file into remote machine</p><blockquote>scp jenkins-backup.zip ubuntu@&lt;REMOTE-IP&gt;:/home/ubuntu</blockquote><p># Unzip and move into remote destination</p><blockquote>ssh -i remote.pem ubuntu@&lt;REMOTE-IP&gt;</blockquote><blockquote>sudo apt-get install unzip</blockquote><blockquote>cd /var/lib/jenkins</blockquote><blockquote>sudo su</blockquote><blockquote>nohup unzip -q /home/ubuntu/jenkins-backup.zip -d / &amp;</blockquote><p># Update the ownership of all Jenkins files</p><blockquote>sudo chown -R jenkins:jenkins /var/lib/jenkins/</blockquote><p># Restart jenkins</p><blockquote>sudo systemctl start jenkins</blockquote><blockquote>sudo systemctl status jenkins</blockquote><p>Try opening the Jenkins from browser, all previous projects and pipelines should be visible.</p><p><strong>Note::</strong></p><ul><li>Encrypted data like keys, passwords etc… although has been transferred but not necessary to be recovered at Remote Machine, must be updated.</li></ul><p>Feel free to ping me for any queries. ankurlnmiit@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb3efce50d9a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/jenkins-migration-to-aws-part-2-eb3efce50d9a">Jenkins Migration to AWS Part-2</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jenkins Migration to AWS Part-1]]></title>
            <link>https://medium.com/finoit/jenkins-migration-to-aws-part-1-4d510b97857a?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/4d510b97857a</guid>
            <category><![CDATA[jenkins-pipeline]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[backup]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[jenkins]]></category>
            <dc:creator><![CDATA[Ankur Parashar]]></dc:creator>
            <pubDate>Fri, 12 Aug 2022 07:01:14 GMT</pubDate>
            <atom:updated>2022-08-12T06:59:00.286Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u-putJTCDwBvenMZ8SLEJg.png" /></figure><p>Following below are the steps needed to transfer Jenkins from one machine to another machine.</p><p><strong>Objectives:</strong></p><ul><li>Transfer all existing projects/pipelines</li><li>Transfer all existing plugins</li><li>Transfer all configuration settings: System Global Tool, Security, Nodes, Credentials</li></ul><h3><strong>Jenkins Installation on AWS Machine:</strong></h3><h4>Step 1 — Prerequisites (Install Java 8)</h4><p>To install this version, first update the package index:</p><pre>sudo apt update</pre><p>Next, check if Java is already installed:</p><pre>java -version</pre><p>If Java is not currently installed, you’ll see the following output:</p><pre>Output<br>Command &#39;java&#39; not found, but can be installed with:</pre><pre>apt install default-jre<br>apt install openjdk-11-jre-headless<br>apt install openjdk-8-jre-headless<br>apt install openjdk-9-jre-headless</pre><p>Execute the following command to install OpenJDK:</p><pre>#for java 8<br>sudo apt install openjdk-8-jre<br>#for latest<br>sudo apt install default-jre</pre><p>This command will install the Java Runtime Environment (JRE). This will allow you to run almost all Java software. Verify the installation with:</p><pre>java -version</pre><p>You may need the Java Development Kit (JDK) in addition to the JRE in order to compile and run some specific Java-based software. To install the JDK, execute the following command, which will also install the JRE:</p><pre>#for java 8<br>sudo apt install openjdk-8-jdk<br>#for latest<br>sudo apt install default-jdk</pre><p>Verify that the JDK is installed by checking the version of javac, the Java compiler:</p><pre>javac -version</pre><p>To set this environment variable, first determine where Java is installed. Use the update-alternatives command:</p><pre>sudo update-alternatives --config java</pre><h4>Step 2 — Installing Jenkins</h4><p>The version of Jenkins included with the default Ubuntu packages is often behind the latest available version from the project itself. To take advantage of the latest fixes and features, you can use the project-maintained packages to install Jenkins.</p><p>First, add the repository key to the system:</p><pre>wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -</pre><p>When the key is added, the system will return OK. Next, append the Debian package repository address to the server’s sources.list:</p><pre>sudo sh -c &#39;echo deb http://pkg.jenkins.io/debian-stable binary/ &gt; /etc/apt/sources.list.d/jenkins.list&#39;</pre><p>When both of these are in place, run the update so that apt will use the new repository:</p><pre>sudo apt update</pre><p>Finally, install Jenkins and its dependencies:</p><pre>sudo apt install jenkins</pre><p>Now that Jenkins and its dependencies are in place, we’ll start the Jenkins server.</p><h4>Step 3 — Starting Jenkins</h4><p>Let’s start Jenkins using systemctl:</p><pre>sudo systemctl start jenkins</pre><p>Since systemctl doesn’t display output, you can use its status command to verify that Jenkins started successfully:</p><pre>sudo systemctl status jenkins</pre><h4>Step 4 — Opening the Firewall</h4><p>By default, Jenkins runs on port 8080, so let’s open that port using ufw:</p><pre>sudo ufw allow 8080</pre><p>Check ufw’s status to confirm the new rules:</p><pre>sudo ufw status</pre><p>You will see that traffic is allowed to port 8080 from anywhere:</p><pre>Output<br>Status: active</pre><pre>To                         Action      From<br>--                         ------      ----<br>OpenSSH                    ALLOW       Anywhere<br>8080                       ALLOW       Anywhere<br>OpenSSH (v6)               ALLOW       Anywhere (v6)<br>8080 (v6)                  ALLOW       Anywhere (v6)</pre><h4>Step 5 — Configuring Jenkins for HTTPS</h4><h4>Step 5.1 — Configuring Nginx</h4><p>First of all, setup nginx with SSL configuration settings.</p><pre>upstream jenkins{<br>    server 127.0.0.1:8080;<br>}</pre><pre>server{<br>    listen      80;<br>    server_name ci.example.com;</pre><pre>    access_log  /var/log/nginx/jenkins.access.log;<br>    error_log   /var/log/nginx/jenkins.error.log;</pre><pre>    proxy_buffers 16 64k;<br>    proxy_buffer_size 128k;</pre><pre>    location / {<br>        proxy_pass  http://127.0.0.1:8080;<br>        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;<br>        proxy_redirect off;</pre><pre>        proxy_set_header    Host            $host;<br>        proxy_set_header    X-Real-IP       $remote_addr;<br>        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header    X-Forwarded-Proto http;<br>    }</pre><pre>}</pre><p>Once you’ve setup test nginx configuration:</p><pre>sudo nginx -t</pre><p>If all is well, the command will return:</p><pre>Output<br>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok<br>nginx: configuration file /etc/nginx/nginx.conf test is successful</pre><p>If not, fix any reported errors until the test passes.</p><h4>Step 5.2 — Configuring Jenkins</h4><p>For Jenkins to work with Nginx, you will need to update the Jenkins configuration so that the Jenkins server listens only on the localhost interface rather than on all interfaces (0.0.0.0). If Jenkins listens on all interfaces, it’s potentially accessible on its original, unencrypted port (8080).</p><p>Let’s modify the /etc/default/jenkins configuration file to make these adjustments:</p><pre>sudo nano /etc/default/jenkins</pre><p>Locate the JENKINS_ARGS line and add --httpListenAddress=127.0.0.1 to the existing :</p><pre>JENKINS_ARGS=&quot;--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --httpListenAddress=127.0.0.1&quot;</pre><p>Save and exit the file.</p><p>To use the new configuration settings, restart Jenkins:</p><pre>sudo systemctl restart jenkins</pre><p>Since systemctl doesn’t display output, check the status:</p><pre>sudo systemctl status jenkins</pre><p>Restart Nginx:</p><pre>sudo systemctl restart nginx</pre><p>Check the status:</p><pre>sudo systemctl status nginx</pre><h3>Step 6 — Setting Up Jenkins</h3><p>To set up your installation, visit <a href="http://ci.finoit.com/">http://ci.example.com</a></p><p>You should see the Unlock Jenkins screen, which displays the location of the initial password. In the terminal window, use the cat command to display the password:</p><pre>sudo cat /var/lib/jenkins/secrets/initialAdminPassword</pre><p>Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.</p><p>The next screen presents the option of installing suggested plugins or selecting specific plugins. We’ll click the skip suggested plugins options, you will be prompted to set up the first administrative user. It’s possible to skip this step and continue as admin using the initial password we used above, but we’ll take a moment to create the user.</p><p>All done.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d510b97857a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/jenkins-migration-to-aws-part-1-4d510b97857a">Jenkins Migration to AWS Part-1</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuous Gitlab backup and restore using rsync]]></title>
            <link>https://medium.com/finoit/continuous-gitlab-backup-and-restore-using-rsync-64458bef0ea2?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/64458bef0ea2</guid>
            <category><![CDATA[lvm]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[rsync]]></category>
            <category><![CDATA[backup-and-restore]]></category>
            <category><![CDATA[gitlab-backup]]></category>
            <dc:creator><![CDATA[Ankur Parashar]]></dc:creator>
            <pubDate>Fri, 12 Aug 2022 06:30:26 GMT</pubDate>
            <atom:updated>2022-08-12T06:30:26.705Z</atom:updated>
            <content:encoded><![CDATA[<h3>Continuous Gitlab backup and restore using resync</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gv2tFuWY_R6T4HIwDAvncA.png" /></figure><p>This article covers backup and restore guidelines for community version of gitlab.</p><p><strong>Objective:</strong></p><p><strong>Step 1:</strong> Configure machine</p><blockquote>sudo apt-get update</blockquote><p><strong>Step 2: </strong>Create LVM on machine for snapshot</p><p># Install GUI partition software</p><blockquote>$ sudo apt-get install gparted</blockquote><p># Display all disk partitions</p><blockquote>$ sudo fdisk -l</blockquote><blockquote>$ sudo vgcreate ubuntu /dev/sda5</blockquote><blockquote>$ sudo lvcreate — extents 100%FREE — name lvgitlab ubuntu</blockquote><blockquote>$ sudo lvresize — size -100G /dev/mapper/ubuntu-lvgitlab</blockquote><blockquote>$ sudo lvcreate — size 14.5G — name lvgitlabswap ubuntu</blockquote><blockquote>$ sudo mkfs.ext4 /dev/ubuntu/lvgitlab</blockquote><blockquote>$ sudo mount /dev/ubuntu/lvgitlab /var/opt/gitlab/</blockquote><p>Note: <a href="http://www.tutonics.com/2012/11/ubuntu-lvm-guide-part-1.html">Guide</a> <a href="https://askubuntu.com/questions/424225/setting-up-lvm-snapshot-as-a-backup-restore-point-in-ubuntu">Guide</a></p><p><strong>Step 3: </strong>Configure LVM to mount permanent</p><blockquote>$ sudo vi /etc/lvm/lvm.conf</blockquote><blockquote># update use_lvmetad setting from 1 to 0</blockquote><blockquote>use_lvmetad = 0</blockquote><p><strong>Step 4:</strong> Install Gitlab: Installation of gitlab over Ubuntu is very easy just follow the steps provided in official documentation. <a href="https://about.gitlab.com/installation/#ubuntu">https://about.gitlab.com/installation/#ubuntu</a> or steps <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-gitlab-on-ubuntu-16-04">here</a>.</p><p><strong>Step 5:</strong> Configure Gitlab:</p><p># Open gitlab configuration file</p><blockquote>$ sudo nano /etc/gitlab/gitlab.rb</blockquote><p>## Backup settings</p><blockquote><strong>gitlab_rails</strong>[<strong>‘manage_backup_path’</strong>] <strong>=</strong> <strong>true</strong></blockquote><blockquote><strong>gitlab_rails[‘backup_path’] = “/mnt/gitlabdb-backup”<br>gitlab_rails[‘backup_archive_permissions’] = 0644</strong></blockquote><blockquote><strong>gitlab_rails</strong>[<strong>‘backup_keep_time’</strong>] = <strong>604800</strong></blockquote><p>## GitLab user privileges</p><blockquote><strong>gitlab_rails[‘gitlab_default_can_create_group’] = false</strong></blockquote><blockquote><strong>gitlab_rails[‘gitlab_username_changing_enabled’] = false</strong></blockquote><blockquote><strong>manage_accounts[‘enable’] = false</strong></blockquote><p>## Default project feature settings</p><blockquote><strong>gitlab_rails[‘gitlab_default_projects_features_issues’] = false</strong></blockquote><blockquote><strong>gitlab_rails[‘gitlab_default_projects_features_merge_requests’] = false</strong></blockquote><blockquote><strong>gitlab_rails[‘gitlab_default_projects_features_wiki’] = false</strong></blockquote><blockquote><strong>gitlab_rails[‘gitlab_default_projects_features_snippets’] = false</strong></blockquote><blockquote><strong>gitlab_rails[‘gitlab_default_projects_features_builds’] = false</strong></blockquote><blockquote><strong>gitlab_rails[‘gitlab_default_projects_features_container_registry’] = false</strong></blockquote><p>## <a href="https://docs.gitlab.com/ce/administration/auth/ldap.html">LDAP </a>settings</p><blockquote><strong>gitlab_rails[‘ldap_enabled’] = true</strong></blockquote><blockquote><strong>gitlab_rails[‘ldap_servers’] = YAML.load &lt;&lt;-’EOS’</strong></blockquote><blockquote><strong>main: # ‘main’ is the GitLab ‘provider ID’ of this LDAP server</strong></blockquote><blockquote><strong>label: ‘LDAP’</strong></blockquote><blockquote><strong>host: ‘&lt;IP ADDRESS&gt;’</strong></blockquote><blockquote><strong>port: 389</strong></blockquote><blockquote><strong>uid: ‘sAMAccountName’</strong></blockquote><blockquote><strong>bind_dn: ‘&lt;MSDOAMIN&gt;\&lt;USER&gt;’</strong></blockquote><blockquote><strong>password: ‘&lt;PASSWORD&gt;’</strong></blockquote><blockquote><strong>encryption: ‘plain’ # “start_tls” or “simple_tls” or “plain”</strong></blockquote><blockquote><strong>verify_certificates: true</strong></blockquote><blockquote><strong>active_directory: true</strong></blockquote><blockquote><strong>allow_username_or_email_login: true</strong></blockquote><blockquote><strong>block_auto_created_users: false</strong></blockquote><blockquote><strong>base: ‘&lt;BASE DN&gt;’</strong></blockquote><blockquote><strong>user_filter: ‘’</strong></blockquote><blockquote><strong># ## EE only</strong></blockquote><blockquote><strong># group_base: ‘’</strong></blockquote><blockquote><strong># admin_group: ‘’</strong></blockquote><blockquote><strong># sync_ssh_keys: false</strong></blockquote><p># Gitlab reconfigure</p><blockquote>$ sudo gitlab-ctl reconfigure</blockquote><p># Disable SignUp</p><p>Admin Area &gt; Settings &gt; Sign-up Restrictions : Uncheck Sign-up enabled → Save</p><p># Update Admin Profile:</p><p>User Settings &gt; Account &gt; Change username : replace root with gitlab.admin</p><p>User Settings &gt; Edit Profile &gt; Main settings &gt; Email : ****@&lt;domain.com&gt;</p><p><strong>Step 4: </strong>Backup<strong>:</strong></p><blockquote>$ sudo mkdir /mnt/gitlab-backup</blockquote><blockquote>$ sudo mkdir /mnt/gitlabdb-backup</blockquote><p>Copy following scripts inside this folder:</p><blockquote>$ sudo mkdir gitlab-scripts</blockquote><p># Weekly backup: ftp_backup.bash</p><p># Daily backup: remotegitlab_backup.bash</p><p># Daily Mail flush: postfix_flush.bash</p><p># Daily Old files flush: clearold_backup.bash</p><blockquote>$ chmod +x /home/ubuntu/gitlab-scripts/ftp_backup.bash</blockquote><blockquote>$ chmod +x /home/ubuntu/gitlab-scripts/remotegitlab_backup.bash</blockquote><blockquote>$ chmod +x /home/ubuntu/gitlab-scripts/postfix_flush.bash</blockquote><blockquote>$ chmod +x /home/ubuntu/gitlab-scripts/clearold_backup.bash</blockquote><blockquote>$ sudo crontab -e</blockquote><p># Configure crons</p><p>## weekly backup</p><blockquote>30 6 * * 6 /home/ubuntu/gitlab-scripts/ftp_backup.bash &amp;&gt; /dev/null</blockquote><p>## daily backup</p><blockquote>30 1 * * * /home/ubuntu/gitlab-scripts/remotegitlab_backup.bash &amp;&gt; /dev/null</blockquote><p>## daily flush</p><blockquote>0 7 * * * /home/ubuntu/gitlab-scripts/postfix_flush.bash &amp;&gt; /dev/null</blockquote><p>## weekly clear</p><blockquote>10 7 * * * /home/ubuntu/gitlab-scripts/clearold_backup.bash &amp;&gt; /dev/null</blockquote><p><strong>Step 4:</strong> Setup Mail Server:</p><ul><li>Follow guidelines from <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-16-04">here</a></li></ul><p><strong>Setup postfix as relay server, for creating app follow this link:</strong></p><p><a href="https://linode.com/docs/email/postfix/postfix-smtp-debian7/">https://linode.com/docs/email/postfix/postfix-smtp-debian7/</a></p><blockquote>$ sudo vi /etc/postfix/sasl/sasl_passwd</blockquote><p># Copy paste following (change app-password to account app password)</p><blockquote>smtp.gmail.com]:587 <a href="/service/mailto:noreply@finoit.com">noreply@&lt;domain&gt;.com</a>:[app-password]</blockquote><p># Create the hash db file for Postfix by running the postmap command:</p><blockquote>sudo postmap /etc/postfix/sasl_passwd</blockquote><p># Run the following commands to change the ownership to root and update the permissions for the two files:</p><blockquote>sudo chown root:root /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db</blockquote><blockquote>sudo chmod 0600 /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db</blockquote><p># Configure postfix:</p><blockquote>sudo vi /etc/postfix/main.cf</blockquote><p># Add specify SMTP relay host</p><blockquote>relayhost =[smtp.gmail.com]:587</blockquote><p><strong>Add following at the end of file:</strong></p><p># enable SASL authentication</p><blockquote>smtp_sasl_auth_enable = yes</blockquote><p># disallow methods that allow anonymous authentication.</p><blockquote>smtp_sasl_security_options = noanonymous</blockquote><p># where to find sasl_passwd</p><blockquote>smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd</blockquote><p># Enable STARTTLS encryption</p><blockquote>smtp_use_tls = yes</blockquote><p># where to find CA certificates</p><blockquote>smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt</blockquote><p>That’s it now restart postfix</p><blockquote>sudo service postfix restart</blockquote><p># Testing Postfix</p><blockquote>echo “This is the body of the email” | mail -s “This is the subject line” ankurlnmiit@gmail.com</blockquote><p><strong>Step 5: </strong>Check the permissions of following folders:</p><p># Git repositories directory</p><p><strong>/var/opt/gitlab/git-data 0700 git:root</strong></p><p># Git repositories</p><p><strong>/var/opt/gitlab/git-data/repositories 2770 git:git</strong></p><p># Holds large object directories</p><p><strong>/var/opt/gitlab/gitlab-rails/shared 0751 git:gitlab-www</strong></p><p># Holds CI artifacts</p><p><strong>/var/opt/gitlab/gitlab-rails/shared/artifacts 0700 git:root</strong></p><p># Holds LFS objects</p><p><strong>/var/opt/gitlab/gitlab-rails/shared/lfs-objects 0700 git:root</strong></p><p># Holds user attachments</p><p><strong>/var/opt/gitlab/gitlab-rails/uploads 0700 git:root</strong></p><p># Holds user pages</p><p><strong>/var/opt/gitlab/gitlab-rails/shared/pages 0750 git:gitlab-www</strong></p><p># Holds CI build logs</p><p><strong>/var/opt/gitlab/gitlab-ci/builds 0700 git:root</strong></p><p># Holds authorized keys</p><p><strong>/var/opt/gitlab/.ssh 0700 git:git</strong></p><p><strong>Step 7: </strong>Configure routing as git.&lt;domain&gt;.com</p><blockquote>$ <em>ssh ankur@&lt;IpAddress&gt;</em></blockquote><blockquote>$ sudo vi /etc/hosts</blockquote><p># Add following</p><blockquote>&lt;Git IPAddress&gt; git.&lt;DOMAIN&gt;.com</blockquote><p># Create nginx configuration file</p><blockquote>$ sudo vi /etc/nginx/sites-available/git</blockquote><p># update: server_name, proxy_pass</p><blockquote>server {</blockquote><blockquote>listen *:80;</blockquote><blockquote>server_name <a href="http://git.finoit.com;/">http://git.&lt;domain&gt;.com;</a></blockquote><blockquote>client_max_body_size 200M;</blockquote><blockquote>location / {</blockquote><blockquote>proxy_set_header Host $host;</blockquote><blockquote>proxy_set_header X-Real-IP $remote_addr;</blockquote><blockquote>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;</blockquote><blockquote>proxy_pass <a href="http://git.finoit.com;/">http://git.&lt;domain&gt;.com;</a></blockquote><blockquote>}</blockquote><blockquote>}</blockquote><p># Enable nginx site configuration</p><blockquote>$ sudo ln -s /etc/nginx/sites-available/git /etc/nginx/sites-enabled/git</blockquote><blockquote>$ sudo service nginx reload</blockquote><p><strong>Step 6: </strong>Restore</p><p>This step is only needed in-case if we are setting up new gitlab server for local network and would like to restore it from remote gitlab server.</p><p># Restore from remote gitlab server script</p><blockquote>$ sudo vi restore_gitlab.bash</blockquote><p>#! bin/bash</p><blockquote>$ chmod +x restore_gitlab.bash</blockquote><blockquote>$ ./restore_gitlab.bash</blockquote><p><strong>Note:</strong> Open Gitlab in browser and check whether everything is working correctly or not.</p><h4><strong>clearold_backup.sh</strong></h4><blockquote>#! /bin/bash</blockquote><blockquote># Path : /home/ubuntu/gitlab-scripts/clearold_backup.bash</blockquote><blockquote># clear db files older than 5 days</blockquote><blockquote>sudo find ‘/mnt/gitlabdb-backup/’ -mtime +4 -type f -delete</blockquote><h4><strong>local_backup_restore.sh</strong></h4><blockquote>#!/bin/bash</blockquote><blockquote># Path: /home/ubuntu/gitlab-scripts/local_backup_restore.bash</blockquote><blockquote># Resync backups to local gitlab server</blockquote><blockquote>[[ $( whoami ) != ‘root’ ]] &amp;&amp; echo “sudo please” &amp;&amp; exit 1</blockquote><blockquote>set -o errexit</blockquote><blockquote>set -o nounset</blockquote><p># Remote path</p><h4><strong>postfix_flush.bash</strong></h4><blockquote>#!/bin/bash</blockquote><blockquote># Path: /home/ubuntu/gitlab-scripts/postfix_flush.bash</blockquote><blockquote>sudo systemctl restart postfix</blockquote><blockquote>postqueue -f</blockquote><h4><strong>restore_backup.sh</strong></h4><blockquote>#!/bin/bash</blockquote><blockquote># Backup tar file for restore</blockquote><blockquote>backup_path=/mnt/gitlabdb-backup/</blockquote><blockquote>BACKUPFILE=`ls -t $backup_path | head -n 1`</blockquote><blockquote># gitlab backup git-data path</blockquote><blockquote>git_data=/mnt/gitlab-backup/git-data</blockquote><blockquote># copy backup git-data to /var/opt/gitlab/git-data</blockquote><blockquote>echo “copying $git_data to /var/opt/gitlab” &gt;&amp;2</blockquote><blockquote>#sudo cp -r $git_data /var/opt/gitlab/</blockquote><blockquote>#sudo sh -c ‘rsync — archive — verbose — bwlimit=50M /mnt/gitlab-backup/git-data/repositories/. /var/opt/gitlab/git-data/repositories’</blockquote><blockquote>#sudo chown -R git:git /var/opt/gitlab/git-data</blockquote><blockquote>echo “Start Copying”</blockquote><blockquote># copy gitlab db backup tar</blockquote><blockquote>sudo cp $backup_path$BACKUPFILE /var/opt/gitlab/backups/</blockquote><blockquote>sudo chown -R git:git /var/opt/gitlab/backups/</blockquote><blockquote>echo “Restarting Gitlab”</blockquote><blockquote>sudo gitlab-ctl stop unicorn</blockquote><blockquote>sudo gitlab-ctl stop sidekiq</blockquote><blockquote>fname=”${BACKUPFILE%_gitlab_backup.tar}”</blockquote><blockquote>sudo gitlab-rake gitlab:backup:restore BACKUP=$fname force=yes</blockquote><blockquote>sudo gitlab-ctl restart</blockquote><blockquote>echo “DONE”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64458bef0ea2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/continuous-gitlab-backup-and-restore-using-rsync-64458bef0ea2">Continuous Gitlab backup and restore using rsync</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Security Guidelines]]></title>
            <link>https://medium.com/finoit/aws-security-guidelines-bad57b0af286?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/bad57b0af286</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[rds]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[iam-roles]]></category>
            <dc:creator><![CDATA[Ankur Parashar]]></dc:creator>
            <pubDate>Thu, 28 Jul 2022 02:42:24 GMT</pubDate>
            <atom:updated>2022-08-01T13:38:00.744Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lOhEqQS72s-XtMtMDnF0Xw.png" /></figure><h3>Following below are basic AWS security guidelines which must be followed by every developer while working with AWS.</h3><p><strong>IAM</strong></p><ol><li>Always use role based access between AWS resources.</li><li>Always create separate IAM users to give access to multiple users.</li><li>Follow the least privilege concept while giving permissions to a user.</li><li>Always have MFA enabled.</li></ol><p><strong>EC2</strong></p><ol><li>Do not open security groups for public, like SSH port should be open for a specific ip instead of public access</li><li>Do not store AWS credentials in EC2 instance, instead give access to EC2 via roles.</li><li>Enable EC2 volume encryption</li><li>Enable EC2 instance termination protection</li></ol><p><strong>RDS</strong></p><ol><li>Enable RDS instance delete protection</li><li>Disable Public access on RDS instance</li><li>Enable Encryption at rest on RDS instance</li><li>Keep proper backup of your prod RDS instance</li><li>Enable Multi AZ for production RDS instance</li><li>Allow db port (3306 or 5432) access from trusted IP’s or security groups.</li><li>IAM policies can be used to assign permissions that determine who is allowed to manage RDS resources</li><li>Use IAM database authentication to connect with your database.</li><li>Enable event notifications of a variety of important events that can occur on the RDS instance, such as whether the instance was shut down, a backup was started, a failover occurred, the security group was changed, or your storage space is low can be received.</li></ol><h3>BastionHost/JumpBox</h3><p>If you are creating AWS EC2, RDS instances over Cloud you should restrict the public access on these instances.</p><p>You should always create a bastion host to provide access to the application instances.</p><p>The bastion hosts provide secure access to Linux instances located in the private and public subnets of your virtual private cloud (VPC).</p><p>To know more and to create a bastion host follow the below link.</p><p><a href="https://aws-quickstart.github.io/quickstart-linux-bastion/">https://aws-quickstart.github.io/quickstart-linux-bastion/</a></p><p><strong>Steps to create your own jumpbox:</strong></p><p>AWS bastion hosts may come with extra cost and complexities so you can create your own jumpbox.</p><ol><li>Create an t2.small instance (jumpbox)</li><li>Open port 22 in the jumpbox security group.</li><li>The port should be open only for your org. VPN or your private static IPs</li><li>Now create your application and db instances and open only relevant ports on those instances.</li><li>Like web app instances should open port 80 and 443 only.</li><li>If you are using an ALB then the app instances should be accessible via ALB only over port 80 and 443.</li><li>The db instance should open ports, for mysql — 3306, psql — 5432, mongo 2207 etc</li><li>The db instance ports should be open only for the application instances.</li><li>If you want to ssh on your app and db instances then you can open port 22 of app and db instances for your jumpbox instance ip only.</li></ol><p><strong>Access app instances via jumpbox:</strong></p><ol><li>Generate ssh keys for your system using the ssh-keygen command.</li><li>(Optional) Connect with Organization VPN server.</li><li>Ssh to the jumpbox via the pem file of the jumpbox instance.</li><li>Add your system ssh public key(cat ~/.ssh/id_rsa.pub) to the jumpbox instance (sudo vi ~/.ssh/authorized_keys)</li><li>Generate ssh keys for your jumpbox using the ssh-keygen command.</li><li>Add your jumpbox ssh public key(cat ~/.ssh/id_rsa.pub) to the app instance (sudo vi ~/.ssh/authorized_keys)</li><li>Now ssh to your app instance without any pem file.</li></ol><p><strong>Note:</strong></p><ol><li>Do not push pem files over jumpbox</li><li>Always use separate pem files for jumpbox and app instances.</li><li>Always create separate security groups for jumpbox and app instances.</li><li>Always use passphrase while creating a ssh key for your system.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bad57b0af286" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/aws-security-guidelines-bad57b0af286">AWS Security Guidelines</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuous Integration using Jenkins for Backend(NodeJs, Python, Angular)]]></title>
            <link>https://medium.com/finoit/continuous-integration-using-jenkins-for-backend-nodejs-python-angular-c0153d6b4e36?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/c0153d6b4e36</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[angular-4]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Ankur Parashar]]></dc:creator>
            <pubDate>Tue, 24 Jul 2018 13:59:06 GMT</pubDate>
            <atom:updated>2018-07-24T13:59:06.311Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jCorPJfSMXIWst0xNH1aMQ.jpeg" /></figure><p>Before beginning to this article make sure <a href="https://jenkins-ci.org/">Jenkins Server</a> is already setup and running. This article covers how to use Jenkins for build automation and deployment over server for script based programming languages.</p><p><strong>Step 1: Configure Machine:</strong></p><blockquote><strong>1.1 Python Prerequisites: </strong>Run the following commands to install essential packages.</blockquote><pre>sudo apt-get update</pre><pre>sudo apt-get install -y build-essential git-core python-dev python-virtualenv nginx supervisor</pre><blockquote><strong>1.2 Node Prerequisites:</strong>Run the following commands to install essential packages.</blockquote><pre>sudo apt-get update<br>sudo apt-get install nodejs<br>sudo apt-get install npm</pre><blockquote><strong>1.3 Angular</strong> <strong>Prerequisites: </strong>Run the following commands to install essential packages.</blockquote><pre>sudo apt-get update<br>sudo apt-get install nodejs<br>sudo apt-get install npm<br>sudo npm install -g @angular/cli</pre><p><strong>Step 2: Project Setup and Configurations:</strong></p><blockquote>2.1 Jenkins → New Item → Freestyle project</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z0mv_dPDJ05JqZAjMWQ0Lg.png" /></figure><blockquote><em>2.2 General</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MyL3IwgJEC0KHu82czJd3g.png" /></figure><p>For saving the project repository in different workspace select “use custom workspace” as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mBBPwUzHya9hipwTB3jdng.png" /></figure><blockquote>2.3 Source Code Management</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WT6YcmrWbE4gLny4xcSoig.png" /><figcaption><strong>Add repository URL, select credentials and specify the source branch to pull.</strong></figcaption></figure><blockquote>2.4 Build Triggers</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lla9yk75gRHByVe394IPyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dLvx8RB4Oi24XhPchhEl7w.png" /></figure><blockquote>2.5 Build: Execute using shell script</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wyut56wQ3e3jE1sVzAKMow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rklh6O20E9RNNNGKkvBuYA.png" /><figcaption><strong>Deploying application on server using script</strong></figcaption></figure><p><strong>Step 3: Deployment Scripts: </strong>This script will cover the following.</p><p><strong>Step 3: Deployment Scripts: </strong>This script will cover the following.</p><blockquote>Pull the latest code to the server</blockquote><blockquote>Run database migrations</blockquote><blockquote>Collect static files</blockquote><blockquote>Restart application</blockquote><pre>ssh &lt;user&gt;@&lt;machine-ip&gt; /home/ubuntu/BackendTest/Scripts/./deploy.bash &lt;Branch&gt;</pre><blockquote><em>3.1 Python Script</em></blockquote><pre>#!/bin/bash</pre><pre>echo &quot;Starting script ...&quot;</pre><pre>user = &#39;myuser&#39;</pre><pre>projectDir = &#39;MyApp&#39;</pre><pre>supervisorapp = &#39;app&#39;</pre><pre>echo &quot;Switching to user...&quot;</pre><pre>sudo -u $user bash &lt;&lt; EOF</pre><pre>echo &quot;In&quot;</pre><pre>echo &quot;Switching to project directory...&quot;</pre><pre>cd &quot;/home/$user/$projectDir/&quot;</pre><pre>echo &quot;Activating Virtual Environment...&quot;</pre><pre>source venv/bin/activate</pre><pre>echo &quot;Pull latest code from branch passed as argument...&quot;</pre><pre>git pull origin $1<br>git checkout $1</pre><pre>echo &quot;Installing Requirements...&quot;</pre><pre>pip install -r requirements.txt</pre><pre>echo &quot;Running migrate for any database migrations...&quot;</pre><pre>python manage.py migrate</pre><pre>echo &quot;Running collectstatic...&quot;</pre><pre>python manage.py collectstatic  &lt;&lt;&lt;yes</pre><pre>EOF</pre><pre>echo &quot;Out&quot;</pre><pre>whoami</pre><pre>echo &quot;Restarting app using supervisor ... &quot;</pre><pre>sudo supervisorctl restart $supervisorapp</pre><blockquote>3.2 Node Script</blockquote><pre>#!/bin/bash</pre><pre>echo &quot;Starting script ...&quot;</pre><pre>user = &#39;myuser&#39;</pre><pre>projectDir = &#39;MyApp&#39;</pre><pre>echo &quot;Switching to project directory...&quot;</pre><pre>cd &quot;/home/$user/$projectDir/&quot;</pre><pre>echo &quot;Pull latest code from branch passed as argument...&quot;</pre><pre>git pull origin $1<br>git checkout $1</pre><pre>echo &quot;Updating dependencies...&quot;</pre><pre>npm i</pre><pre>echo &quot;Restarting Process Manager...&quot;</pre><pre>pm2 restart all</pre><blockquote>3.3 Angular Script</blockquote><pre>#!/bin/bash</pre><pre>echo &quot;Starting script ...&quot;</pre><pre>user = &#39;myuser&#39;</pre><pre>projectDir = &#39;MyApp&#39;</pre><pre>echo &quot;Switching to project directory...&quot;</pre><pre>cd &quot;/home/$user/$projectDir/&quot;</pre><pre>echo &quot;Pull latest code from branch passed as argument...&quot;</pre><pre>git pull origin $1<br>git checkout $1</pre><pre>echo &quot;Updating dependencies...&quot;</pre><pre>npm i</pre><pre>echo &quot;Creating Build...&quot;</pre><pre>ng build --prod --build-optimizer --env=prod</pre><pre>echo &quot;Switching to build directory...&quot;</pre><pre>cd &quot;dist&quot;</pre><pre>echo &quot;Restarting Process Manager...&quot;</pre><p><strong>Script 4: Generate an SSH key on Jenkins machine and add your public key to the server for authentication:</strong></p><blockquote>4.1 Generate ssh keys for jenkins user.</blockquote><pre>sudo su jenkins</pre><pre>ssh-keygen -t rsa</pre><blockquote>4.2 Copy public key</blockquote><pre>cat ~/.ssh/id_rsa.pub</pre><blockquote>4.3 Add public key to server authorized_keys</blockquote><pre>ssh &lt;user&gt;@&lt;machine-ip&gt;</pre><pre>vi ~/.ssh/authorized_keys</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dmBg6kUFd8iWZqTtSKRk2A.png" /><figcaption><strong>Jenkins Command line displaying successful completion of deployment.</strong></figcaption></figure><p>This tutorial has been designed keeping things in mind that Development, Jenkins and Server machines are separate.</p><pre>In current scenario Jenkins is installed over Mac environment and source is being pushed either from Linux or Windows machine.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0153d6b4e36" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/continuous-integration-using-jenkins-for-backend-nodejs-python-angular-c0153d6b4e36">Continuous Integration using Jenkins for Backend(NodeJs, Python, Angular)</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continues Integration using Jenkins for Java(Spring)]]></title>
            <link>https://medium.com/finoit/continues-integration-using-jenkins-for-java-spring-4439ecd23bec?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/4439ecd23bec</guid>
            <category><![CDATA[continuous-deployment]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[gitlab]]></category>
            <dc:creator><![CDATA[Ankur Parashar]]></dc:creator>
            <pubDate>Sat, 17 Feb 2018 14:28:18 GMT</pubDate>
            <atom:updated>2018-02-17T14:28:18.302Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N5tbHtb57lNBhqR1GRCMzg.png" /><figcaption>ng</figcaption></figure><p>Before beginning to this article make sure <a href="https://jenkins-ci.org/">Jenkins Server</a> is already setup and running. This article covers how to use Jenkins for Build Automation and Deployment over Tomcat Server for Spring application.</p><p><strong>Step 1: Configure Global Variables:</strong></p><blockquote><em>1.1 JAVA : Manage Jenkins → Global Tool Configuration → JDK Installations → Add JDK</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*nQ9HQNarxAj5gRktP2wjMg.png" /></figure><blockquote>1.2 Git : Manage Jenkins → Global Tool Configuration → Git</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*TNWyEVBZJ0XhqkCJ_XNjeg.png" /></figure><p><strong>Step 2: Configure Deployment Plugin:</strong></p><blockquote>2.1 Manage Jenkins → Plugin Manager → Available → Search <strong>“Deploy to container Plugin” </strong>→ Install</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_qiC9suOAGhUXK6Zk8Sn9Q.png" /></figure><p><strong>Step 3: Configure Tomcat Credentials:</strong></p><blockquote>3.1 Credentials → System → Global Credentials → Add Credentials → Enter Tomcat manager credentials</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B6D820NrbILUaPQJ1SF5SA.png" /></figure><p><strong>Step 4: Project Setup and Configurations:</strong></p><blockquote>2.1 Jenkins → New Item → Freestyle project</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*REP9cLi2FH6QVQW1fhjsVA.png" /></figure><blockquote>2.2 General</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gnrlZ-0kAAPLt--VsRqixg.png" /></figure><p>For saving the project repository in different workspace select “use custom workspace” as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C8RV6NlTntBp6WLPxhcAzg.png" /></figure><blockquote>2.3 Source Code Management</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*58x7MUz8EMAh6Xxp4HKBwQ.png" /><figcaption><strong>Add repository URL, select credentials and specify the source branch to pull.</strong></figcaption></figure><blockquote>2.4 Build Triggers</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5H8Exwd093Ih0g2wRZwgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxqZl_HpT131jgCKQRm8ag.png" /></figure><blockquote>2.5 Build: Execute using shell script</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wyut56wQ3e3jE1sVzAKMow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YkHsOJXOK6MqbrbN8NS4jA.png" /></figure><blockquote>2.6 Post-build Actions</blockquote><p>2.6.1 Archive .war files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQ2jl2V9l0yytr_gI4CxUA.png" /></figure><p>2.6.2 Deploy wat to Tomcat Container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-5h_CusTi8jjXqmuRjUlsQ.png" /></figure><p><strong>Step 4: Build Progress:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qHroBiIsaJ-2nbK7SG-6yg.png" /><figcaption><strong>Make sure Build is successfully created</strong></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4439ecd23bec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/continues-integration-using-jenkins-for-java-spring-4439ecd23bec">Continues Integration using Jenkins for Java(Spring)</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuous Integration using Jenkins and AppBox for iOS]]></title>
            <link>https://medium.com/finoit/continuous-integration-using-jenkins-and-appbox-for-ios-d1c10ebd3d72?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/d1c10ebd3d72</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[appbox]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <dc:creator><![CDATA[Vineet Choudhary]]></dc:creator>
            <pubDate>Thu, 01 Feb 2018 13:57:41 GMT</pubDate>
            <atom:updated>2019-03-14T04:56:39.108Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dp_3SAlxCtqIJQ0yBZlGIA.png" /></figure><p>Before beginning to this article make sure <a href="https://jenkins-ci.org/">Jenkins Server</a> and <a href="http://getappbox.com/">AppBox</a> is already setup and running. This article covers how to use Jenkins and <a href="http://getappbox.com/">AppBox</a> for Build Automation and Deployment of Development, Ad-Hoc and In-house (Enterprise) iOS applications directly to the devices from your Dropbox account.</p><h3>1. Setup Xcode Project for AppBox</h3><h4>1.1 AppBox Project setting plist</h4><p>Add a appbox.plist file in your project main directory. This file will contains the build information of your project.</p><p><strong>Demo Plist</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;<br>&lt;plist version=&quot;1.0&quot;&gt;<br>&lt;dict&gt;<br>	&lt;key&gt;project&lt;/key&gt;<br>	&lt;string&gt;TestJenkins.xcodeproj&lt;/string&gt;<br>	&lt;key&gt;scheme&lt;/key&gt;<br>	&lt;string&gt;TestJenkins&lt;/string&gt;<br>	&lt;key&gt;buildtype&lt;/key&gt;<br>	&lt;string&gt;development&lt;/string&gt;<br>	&lt;key&gt;teamid&lt;/key&gt;<br>	&lt;string&gt;4F7SW76LL6&lt;/string&gt;<br>	&lt;key&gt;keepsamelink&lt;/key&gt;<br>	&lt;true/&gt;<br>	&lt;key&gt;dropboxfoldername&lt;/key&gt;<br>	&lt;string&gt;&lt;/string&gt;<br>	&lt;key&gt;email&lt;/key&gt;<br>	&lt;string&gt;user@example.com&lt;/string&gt;<br>	&lt;key&gt;personalmessage&lt;/key&gt;<br>	&lt;string&gt;Test Build&lt;/string&gt;<br>&lt;/dict&gt;<br>&lt;/plist&gt;</pre><p><strong>AppBox.plist key description</strong></p><ul><li><strong>project </strong>(string, required) — Name of the Xcode project/workspace file. Project must be manage signing automatically.</li><li><strong>scheme </strong>(string, required) — Name of the scheme to build. Project scheme must be <a href="https://docs.getappbox.com/FAQs/sharexcodeprojectschemes/">shared</a>.</li><li><strong>buildtype </strong>(string, required) — “ad-hoc”, “enterprise”, “app-store” or “development”</li><li><strong>teamid </strong>(string, required) — Development TeamId.</li><li><strong>email </strong>(string, required) — mail build share url</li><li><strong>personalmessage </strong>(string, optional) — Attach personal message in email</li><li><strong>keepsamelink </strong>(boolean, optional) — true/false (<a href="https://docs.getappbox.com/Features/keepsamelink/">read more</a>)</li><li><strong>dropboxfoldername </strong>(string, optional) — Custom Dropbox Folder Name (By default will be bundle identifier).</li><li><strong>itcemail </strong>(string, optional) — iTunesConnect/AppStore Connect email (if buildtype is app-store).</li></ul><p><strong>Note — </strong>Project must be manage signing automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kHRCO2X9mOBmX1hScaCijw.png" /><figcaption>Xcode automatically manage signing</figcaption></figure><h4>1.2 Private keys and Provisioning Profiles</h4><p>All your private keys and provisioning profile should be in a directory called cert inside project main directory. Directory cert will include certificates and provisioning profile and plist with name appbox.plist</p><p><strong>Note</strong> — All private key must have some valid password.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;<br>&lt;plist version=&quot;1.0&quot;&gt;<br>&lt;array&gt;<br>	&lt;dict&gt;<br>		&lt;key&gt;name&lt;/key&gt;<br>		&lt;string&gt;Certificates.p12&lt;/string&gt;<br>		&lt;key&gt;password&lt;/key&gt;<br>		&lt;string&gt;password&lt;/string&gt;<br>	&lt;/dict&gt;<br>	&lt;dict&gt;<br>		&lt;key&gt;name&lt;/key&gt;<br>		&lt;string&gt;Test_Jenkins_Developer.mobileprovision&lt;/string&gt;<br>	&lt;/dict&gt;<br>	&lt;dict&gt;<br>		&lt;key&gt;name&lt;/key&gt;<br>		&lt;string&gt;Test_Jenkins_InHouse.mobileprovision&lt;/string&gt;<br>	&lt;/dict&gt;<br>&lt;/array&gt;<br>&lt;/plist&gt;</pre><p>download demo appbox.plist and cert/appbox.plist from <a href="https://github.com/vineetchoudhary/AppBox-iOSAppsWirelessInstallation/blob/Screenshot/appboxci.zip">here</a>.</p><h4>1.3 Project Directory Structure</h4><p>After full setup, your project directory will be look like this -</p><pre>ProjectName (This is  your project main directory)<br>|- ProjectName<br>|- Project.xcodeproj<br>|- Project.xcworkspace<br><em>|-</em><strong><em> appbox.plist (Appbox project setting file)<br></em></strong><em>|-</em><strong><em> cert (Appbox project certificate directory)<br></em></strong><em>|   |-</em><strong><em> appbox.plist (Appbox certificate information file)<br></em></strong><em>|   |- Cetificates1.p12<br>|   |- Cetificates2.p12<br>|   |- Project-adhoc.mobileprovision<br>|   |- Project-enterprice.mobileprovision<br>|   |- Project-appstore.mobileprovision</em><br>|- ProjectTests (If any)</pre><h3><strong>2. Setup Jenkins Project and Configurations</strong></h3><h4><em>2.1 Create Project</em></h4><p>Create a new Jenkins project using freestyle option.<br><strong><em>Jenkins → New Item → Enter project name → Freestyle project → Click OK</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTgrK0GpvOa40TKa_oOyuQ.png" /><figcaption>Create new Project</figcaption></figure><h4><em>2.2 General </em>Configurations</h4><p>In general configurations, you can <strong><em>Enable</em> <em>project-based security</em></strong><em>. </em>In which you can manage the different project member with their access level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mx0Io292zbXGkCVIOWTb7g.png" /><figcaption>Enable project-based security</figcaption></figure><p>Also, You might be need to enable <strong>Restrict where this project can be run </strong>if you want build this project in jenkins remote node. Like, In <a href="http://finoit.com/">Finoit </a>we use separate jenkins remote node for iOS projects. So, If you are in Finoit, label expression for this field will be <strong>iOS. </strong>😉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*imDAhaJ4GpJ-Q_P7VW7bGA.png" /></figure><h4>2.3 <em>Source Code Management</em></h4><p>Check <strong><em>Git</em></strong> in the section <strong><em>Source Code Management</em></strong> and enter the url of the repository and select the right credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g83lD_gFn0za0AXh7IUHrA.png" /><figcaption>Source Code Management</figcaption></figure><h4><em>2.4 Build Triggers</em></h4><p>In <strong><em>Build triggers </em></strong>section check the option to <strong><em>Build when a change is pushed to GitLab</em></strong>. This will trigger the build when a change is pushed to Gitlab. There’s a small bug with the plugin key generation so <strong><em>Save or Apply</em></strong> the changes to the job first, then under <strong>Advanced</strong> generate a key. Gitlab requires this key. Here you can also apply the filter by branches name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ns_l0wYDfZVpsJrczxpwrw.png" /><figcaption>Build Triggers</figcaption></figure><h4><strong>2.5 Connect GitLab And Jenkins</strong></h4><p>In this setup you’ll setup your GitLab repository for Jenkins, so that Jenkins is automatically notified when there’s a new commit to the GitLab repository and can commit successful builds back to it. To do this:</p><p><strong>2.5.1</strong> Open GitLab and browse to the GitLab page for the project.<br><strong>2.5.2</strong> Go to the Project Integration page via<strong><em> Settings → Integrations<br>2</em>.5.3</strong> Configure a new Jenkins webhook as follows:<br> — In the <strong><em>URL</em></strong> field, enter the Jenkins <strong><em>Gitlab CI service URL</em></strong> from Step 2.4 .<br>— In the <strong><em>Secret Token </em></strong>field, enter the <strong><em>Secret token</em></strong> form Setup 2.4.<br>— In the list of triggers, select the events that should trigger a new Jenkins build, such as new <strong><em>Push Events </em></strong>or <strong><em>Accept Merge Request Events</em></strong>. <br>— Click <strong><em>Add Webhook.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R4_keqBSmuJPkbVDMMnebw.png" /><figcaption>Jenkins Integration in Gitlab Project</figcaption></figure><h4><strong>2.6 Build</strong></h4><p>In <strong>Build</strong> step, we need to execute AppBox with current workspace. So, add the following command</p><pre>/Applications/AppBox.app/Contents/MacOS/AppBox build=$WORKSPACE</pre><p>Make sure AppBox must be available in your Applications directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ms6VjoWf7WQkLHzeR9F8ug.png" /><figcaption>Build</figcaption></figure><p><strong>AppBox Advanced Commands</strong></p><blockquote><strong><em>build</em></strong> — Always will be <strong><em>$WORKSPACE </em></strong>(required)<br><strong><em>scheme</em></strong> — here you can override the scheme name from appbox.plist in <strong>step 1.1</strong> (optional)<br><strong><em>buildtype</em></strong> — here you can override the buildtype from appbox.plist in <strong>step 1.1</strong> (optional)</blockquote><p><strong>Example</strong></p><pre>/Applications/AppBox.app/Contents/MacOS/AppBox build=$WORKSPACE  scheme=ProjectLIVE buildtype=app-store</pre><h4>2.7 Post-build Actions</h4><p>Finally, in the <strong><em>Post-build Actions </em></strong>step we need to <strong><em>Publish build status to GitLab commit </em></strong><em>and </em><strong><em>Add note with build status on Gitlab merge request</em></strong>. This enables the feedback and gives us pretty indicators in GitLab commit and merge request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ln5nxICI3M6FRtsUieiS_g.png" /><figcaption>Post-build Actions</figcaption></figure><p>Your Continuous Integration (CI) and Continuous Delivery (CD) with Jenkins and AppBox is now ready for use!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1c10ebd3d72" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/continuous-integration-using-jenkins-and-appbox-for-ios-d1c10ebd3d72">Continuous Integration using Jenkins and AppBox for iOS</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuous Integration using Jenkins with Gitlab and JIRA]]></title>
            <link>https://medium.com/finoit/continuous-integration-using-jenkins-with-gitlab-and-jira-ec72223324c6?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/ec72223324c6</guid>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[continuous-deployment]]></category>
            <category><![CDATA[jenkins]]></category>
            <dc:creator><![CDATA[Ankur Parashar]]></dc:creator>
            <pubDate>Sat, 06 Jan 2018 09:21:44 GMT</pubDate>
            <atom:updated>2018-02-17T08:04:35.032Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SpYGWuLwtMhGuWk-qafzHQ.png" /></figure><p>Before beginning to this article make sure <a href="https://jenkins-ci.org/">Jenkins Server</a>, <a href="https://gitlab.com/gitlab-org/gitlab-ce">Gitlab Server</a> and <a href="https://www.atlassian.com/software/jira">JIRA</a> are already setup and running.</p><p><strong>Step 1: Integrate Gitlab with Jenkins:</strong></p><blockquote>Generate Access Token in Gitlab: Gitlab → User Settings → Access Token</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZDqEkqfc81Ir5oya8yY_8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*9pkMDeVGubkZr425AfDuag.png" /></figure><blockquote>Configure Global Key in Jenkins: Jenkins → Credentials → System → Global Credentials → Add Credentials</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BPq7E2rLXhN5C8Ao7aIYIQ.png" /><figcaption>Add the API Token generated in previous steps. Once added it will appear in Global Credentials listing.</figcaption></figure><blockquote>Configure Connection Between Jenkins and Gitlab: Jenkins → Manage Jenkins → Configure System → Gitlab</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*YfhkZNd_pVfzyWJ2RwTLFw.png" /></figure><p><strong>Step 2: Configure Jenkins Build Triggers and Post-Build Actions</strong></p><blockquote>Go to Jenkins → &lt;PROJECT&gt; → Configure → Build Triggers</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*_pmykbzyWfgpd5_RmDlxAw.png" /><figcaption>Above Gitlab CI Service URL will be used inside the Gitlab as Webhook URL</figcaption></figure><blockquote>Go to Jenkins → &lt;PROJECT&gt; → Configure → Build Triggers → Advanced → Secret Token → Click Generate</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*BuKJKlJqt15B3HPoTOf7FQ.png" /><figcaption>This token will be used inside Gitlab as Webook</figcaption></figure><blockquote>Go to Jenkins → &lt;PROJECT&gt; → Configure → Post-build Actions</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*TR65g4_lZv2Py6j5Ffm2XQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*aBQRqT-B6Sj0s5XghLqUSQ.png" /><figcaption>This will enable the feedback from Jenkins to Gitlab once Build has been completed.</figcaption></figure><p><strong>Step 3: Configure Gitlab Webhooks</strong></p><p>Go to Gitlab → Projects → &lt;Project&gt; → Settings → Integrations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iAUGsPcjLJEQKTqKc-xt6w.png" /><figcaption>Add Gitlab CI Service URL and Secret Token Generated and Click on Add Webhook.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*GGuN4j14cmIWHYHoTzgwlw.png" /><figcaption>Once Webhook has been added we will be able to test the events from here.</figcaption></figure><p>Here is an example of after clicking the Push events button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*a3Ui_Z_1HskiEnG1hr8ykA.png" /><figcaption>Gitlab shows the status that Jenkins is creating the Build from Commit.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BaVfLU4NoqwpFbquyhJyxQ.png" /><figcaption>Inside Jenkins you will see that Build has been triggered from Gitlab</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*CUPUdztc6KZy9dVM0lRWZw.png" /><figcaption>After success completion of Build Giltab displays the status of Build.</figcaption></figure><p><strong>Step 4: Integrate JIRA with Gitlab:</strong></p><p>Gitlab → Admin Area → Service Templates → JIRA</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y9izt0d0eMgTlMaHL-Tqug.png" /><figcaption>Add your JIRA instance credentials</figcaption></figure><p>After saving above configuration your Gitlab Project will be able to Interact with all JIRA Project. JIRA issue in GitLab will automatically add a comment in JIRA issue with the link back to GitLab.</p><p>While commit source over Gitlab don’t forget to mention the JIRA issue in comment as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*exFb4CbB3cDP2PGnWpp3WQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xRRS8IL6_ZLSQxusSdKw2g.png" /><figcaption>Mentioning JUI-3 as JIRA Issue Id in Gitlab Commit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*O1SyuypcfwJLfy4DstQuyA.png" /><figcaption>Link of Gitlab Commit/Merge in JIRA</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*B2iUqk65cvzdtU8GcpaL7g.png" /><figcaption>Comment on JIRA when source is committed on Gitlab</figcaption></figure><p>For more detailed reference please go through <a href="https://docs.gitlab.com/ee/user/project/integrations/jira.html">GitLab JIRA integration</a> documentation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec72223324c6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/continuous-integration-using-jenkins-with-gitlab-and-jira-ec72223324c6">Continuous Integration using Jenkins with Gitlab and JIRA</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuous Integration using Jenkins for Android]]></title>
            <link>https://medium.com/finoit/continuous-integration-using-jenkins-for-android-72782b9ab3d0?source=rss----3163d5ccc23c---4</link>
            <guid isPermaLink="false">https://medium.com/p/72782b9ab3d0</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ankur Parashar]]></dc:creator>
            <pubDate>Fri, 05 Jan 2018 16:22:24 GMT</pubDate>
            <atom:updated>2018-05-23T06:33:50.860Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iV1dRhGnfVhOzmW3ZnJtlg.png" /></figure><p>Before beginning to this article make sure <a href="https://jenkins-ci.org/">Jenkins Server</a> is already setup and running. This article covers how to use Jenkins for Build Automation and Deployment over FTP, DropBox for Android projects.</p><p><strong>Step 1: Configure Global Variables:</strong></p><blockquote>1.1 JAVA : Manage Jenkins → Global Tool Configuration → JDK Installations → Add JDK</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*KyI6E-L7UX_fHYsa7r5JpA.png" /></figure><blockquote>1.2 Git : Manage Jenkins → Global Tool Configuration → Git</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*-5jMnv68Gkrx9Fnc8az68Q.png" /></figure><blockquote>1.3 Android: Manage Jenkins → Configure System → Global properties → Environment variables -&gt; Add</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*bq3UfSJgdGmrC56yM_OCmQ.png" /></figure><p><strong>Step 2: Project Setup and Configurations :</strong></p><blockquote>2.1 Jenkins → New Item → Freestyle project</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PlGfLzLajxH_quuX2EEokw.png" /></figure><blockquote>2.2 General</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2fx0TASsoeXKRsjWAeCLdg.png" /></figure><p>For saving the project repository in different workspace select “use custom workspace” as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F0dJDdd783nkJ3TWuruOxQ.png" /><figcaption>This option will be visible after pressing “Advanced” button in General section</figcaption></figure><blockquote>2.3 Source Code Management</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Our40Q4df4KCPGfElWU9-A.png" /><figcaption><strong>Add repository URL, select credentials and specify the source branch to pull.</strong></figcaption></figure><blockquote>2.4 Build Triggers</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zdzLQKjerDmhpsEs8YrM_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*7Pw33saTueqKixvvsAYVhA.png" /></figure><blockquote>2.5 Build</blockquote><p>2.5.1 Execute using Gradle script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EUOsUQhX72G0MwaIYjNZNw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3NJJKM-JGav3-M80s4IV6w.png" /></figure><p>2.5.2 Execute using shell script</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CliTZWq56-8f4klQZppqxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Uc6OLrWppFsBt7p44YehQ.png" /></figure><blockquote>2.6 Post-build Actions</blockquote><p>2.6.1 Archive .apk files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vjfUMC6KGSxCOHGf-rC8yQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*miw6D_lGhPUNh5j5oKQV7A.png" /></figure><p>2.6.2 Upload .apk to Dropbox folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yOUqE9s5-AQ0gXXc07iiew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KpVFLVudTOFICbVaOWY0Fg.png" /></figure><p>2.6.3 Upload .apk to FTP folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RM31a86kNSB_m2mQWYImvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6eYEbgwMfjXj0mocSTmo-Q.png" /></figure><p><strong>Step 3: Build Progress</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nJwg-gHJYoahhZuJXWV4QQ.png" /><figcaption><strong>Press the Build now button for start the execution of build.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QUUYexy_szq9GoqOetQ_LA.png" /><figcaption><strong>Check the Build progress</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vS3pxCEqPOXg5Y0f4da3Nw.png" /><figcaption><strong>Reviewing the console output</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*uOagkrq_lr_uRzbA7XJnNw.png" /><figcaption><strong>Make sure Build is successfully created</strong></figcaption></figure><p><strong>Step 4: Troubleshooting</strong></p><blockquote>Problem: Execution failed for task ‘:app:mergeDebugResources’.<br>Solution: disable the build cache for your project, add the following to its gradle.properties file:</blockquote><pre><strong>android.enableBuildCache=false</strong></pre><blockquote>Problem: Execution failed for task :app:lintVitalReleaseD:<br>Solution: Add following lintOptions to build.gradle</blockquote><pre>android {<br>  buildTypes {<br>         release {<br>              lintOptions {<br>                   <strong>checkReleaseBuilds false <br>                   abortOnError false</strong><br>              }<br>         }<br>    }<br>}</pre><blockquote>Problem: <br> — Error with gradlew: /usr/bin/env: bash: No such file or directory<br> — ./gradlew clean env: bash\r: No such file or directory Build step ‘Execute shell’ marked build as failure</blockquote><blockquote>Solution: The problem’s cause was that Git on Windows converted the line endings of gradlew from Unix style (LF) to Windows style (CRLF).<br> — <a href="https://stackoverflow.com/questions/22301956/error-with-gradlew-usr-bin-env-bash-no-such-file-or-directory">https://stackoverflow.com/questions/22301956/error-with-gradlew-usr-bin-env-bash-no-such-file-or-directory</a><br>Dwonload: <a href="https://sourceforge.net/projects/dos2unix/?source=typ_redirect">https://sourceforge.net/projects/dos2unix/?source=typ_redirect</a></blockquote><pre>In current scenario Jenkins is installed over Mac environment and source is being pushed either from Linux or Windows machine.<br>Based on development environment convert gradlew.bash using dos2unix utility, push again to git and try executing build again.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72782b9ab3d0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/finoit/continuous-integration-using-jenkins-for-android-72782b9ab3d0">Continuous Integration using Jenkins for Android</a> was originally published in <a href="https://medium.com/finoit">finoit</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>