Git Product home page Git Product logo

Comments (8)

stevenconner avatar stevenconner commented on June 11, 2024 6

thanks for the PR, kmmceachern, unfortunately i'm still having this problem even after using your changes. what fixed it for me finally was making your code use -y for apt-get install, so changes to jenkins would be like so:

add-apt-repository ppa:openjdk-r/ppa
apt-get update
apt-get install -y openjdk-8-jre openjdk-8-jre-headless openjdk-8-jdk

from devops-intro-project.

kmmceachern avatar kmmceachern commented on June 11, 2024 2

Finally figured out a solution for this error after digging around some.

First off, I had two problems initially:

  1. As a new free tier AWS user, I had an instance limit of 0 for t1.micros, which is what the provided control-server.json file uses for the Ubuntu AMI. To fix this I changed my control-server.json to
      {
        "type": "amazon-ebs",
        "access_key": "{{ user `AWS_ACCESS_KEY_ID` }}",
        "secret_key": "{{ user `AWS_SECRET_ACCESS_KEY` }}",
        "region": "us-east-1",
        "source_ami": "ami-772aa961",
        "instance_type": "t2.micro",
        "ssh_username": "ubuntu",
        "ami_name": "control-{{ user `PACKER_BOX_NAME` }}-{{timestamp}}"
      },

The above source-ami is the only Ubuntu 14.04 AMI I could access as a free tier user through AWS's EC2 console, as it uses a t2.micro instead of t1.micro.

  1. The Jenkins script would not execute properly because the script file located at /packer-templates/scripts/jenkins.sh tries to install a Java version that's incompatible with the latest version of Jenkins.
    To fix this I replaced these lines in jenkins.sh:
# JDK and JRE are required for Jenkins
apt-get install -y openjdk-7-jre openjdk-7-jdk unzip dos2unix

with (edited below to reflect @stevenconner's suggestion of adding the -y flag)

# JDK and JRE are required for Jenkins
add-apt-repository ppa:openjdk-r/ppa
apt-get update
apt-get install -y openjdk-8-jre openjdk-8-jre-headless openjdk-8-jdk

after seeing this resolution to a similar problem filed as a Jenkins JIRA issue here (last comment): https://issues.jenkins-ci.org/browse/JENKINS-43495?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&showAll=true

After both of these changes, my AMI FINALLY built properly.

I've put up a PR with all the file changes I needed to properly build and deploy the AMI, so future course takers will hopefully have an easier time with this than I did: #35

from devops-intro-project.

alejandromarcu avatar alejandromarcu commented on June 11, 2024

I'm having the same issue. Did you find a solution?

from devops-intro-project.

Garett-Haight avatar Garett-Haight commented on June 11, 2024

Similar issue here. I'm going to dig through the config files to see if I can find anything....

from devops-intro-project.

pivec avatar pivec commented on June 11, 2024

same problem :/

from devops-intro-project.

ntjn avatar ntjn commented on June 11, 2024

Same issue/solution in case of deploying onto gcloud.

from devops-intro-project.

CodeWithOz avatar CodeWithOz commented on June 11, 2024

Thanks so much to @kmmceachern and @stevenconner for your solutions. I had to add a little more code before I could get mine to build.

First, I had to use a more recent Ubuntu server version and checksum (see README.md and here) in control-server.json:

{
"variables": {
      ...
      "PACKER_BOX_NAME": "ubuntu-14.04.5-server-amd64",
      ...
      ...
  "builders": [
      {
        ...
        ...
        "iso_checksum": "dde07d37647a1d2d9247e33f14e91acb10445a97578384896b4e1d985f754cc1",
        ...
        ...
}

Second, I had to install dos2unix (see here) in jenkins.sh by adding

# install dos2unix
sudo apt-get install dos2unix

after these lines 👇

apt-get update
apt-get install -y jenkins
apt-get upgrade

I am running Windows 10 by the way.

Update

I still had to do a bit more work. Apparently, my Windows converted Unix-style endings (\n) into Windows-style endings (\r\n) and this caused errors in install_jenkins_plugins.sh. To fix this, I added this line

dos2unix /tmp/jenkins-config/install_jenkins_plugins.sh

after this line

dos2unix /etc/default/jenkins

in jenkins.sh.

Still, the installPlugins() function in install_jenkins_plugins.sh threw errors indicating that it could not find the unzip command. So I included these lines

# install unzip for use in install_jenkins_plugins.sh
sudo apt-get install zip unzip

just above these lines

# install some extra plugins
/bin/bash /tmp/jenkins-config/install_jenkins_plugins.sh

My artifacts built successfully but I still could not figure out how to view the Jenkins server in my browser. This may be obvious to more experienced users but the course does not give clear instructions for a first-time user like me. The solution involved two steps:

  • First, I had to configure the AWS security group used by the VM to allow inbound access on port 8080 (in addition to SSH access on port 22).
  • Second, the actual URL to access the Jenkins server in the browser is <Public DNS (IPv4)>:8080/jenkins. You can find the value of <Public DNS (IPv4)> from the running instance in your AWS EC2 dashboard. So your URL will look something like this: ec2-12-345-678-901.compute-1.amazonaws.com:8080/jenkins.

from devops-intro-project.

13rac1 avatar 13rac1 commented on June 11, 2024

@CodeWithOz I've merged/closed all, but one PR in this repo. If you can submit a PR fixing Jenkin's I'll merge it. LMK. Thanks!

from devops-intro-project.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.