Skip to content

rsouza01/devops-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


logo
DevOps-Java

Small tutorial for DevOps and Java

Steps

1.Setting the production environment.

  • Virtual Box
  • Vagrant
  • Vagrant Ubuntu Image(vagrant box add hashicorp/precise32)
  • Vagrant up!
  • db:mysql and web:tomcat installed.

MySQL

  • Remove anonymous account:

    mysql -uroot -p -e "DELETE FROM mysql.user WHERE user=''; FLUSH PRIVILEGES"

  • Creates app user:

    mysql -uroot -p -e "GRANT ALL PRIVILEGES ON loja_schema.* TO 'loja'@'%' IDENTIFIED BY 'lojasecret';"

  • Test new user:

    mysql -u loja -p loja_schema -e "select database(), user()"

COMMANDS

  • Start the VMs:

    vagrant up vagrant up

  • Shutdown the VMs:

    vagrant halt

  • Destroy VMs:

    vagrant destroy

  • Change VM's after running:

    vagrant provision

  • Boxes (using bento boxes)

    vagrant list boxes

    vagrant box add <BOX_NAME>

    vagrant box remove <BOX_NAME>

  • SSH

    vagrant ssh vagrant ssh db vagrant ssh web

  • Increase MAVEN memory BEFORE build

    vagrant@web$ export MAVEN_OPTS=-Xmx1536m

  • Tomcat Folders

    Config: /etc/default/tomcat7/

    JAVA_OPTS="-Djava.awt.headless=true -Xmx1024M -XX:+UseConcMarkSweepGC"

    Applications: /var/lib/tomcat7/webapps/

  • Tomcat Commands Stop: sudo service tomcat7 stop

    Restart: sudo service tomcat7 restart

  • Application

  • Nagios Dashboard

  • Jenkins

Getting the admin password:

vagrant ssh ci -- 'sudo cp /var/lib/jenkins/secrets/initialAdminPassword /vagrant'

  • [Jenkins] - Plugins dependencies

    Maven Integration plugin v2.16 junit v1.6 is missing. To fix, install v1.6 or later. Jenkins Mailer Plugin v1.20 failed to load. Fix this plugin first. Jenkins Git plugin v3.3.1 workflow-scm-step v1.14.2 is missing. To fix, install v1.14.2 or later. Credentials Plugin v2.1.14 failed to load. Fix this plugin first. Jenkins Parameterized Trigger plugin v2.34 conditional-buildstep v1.3.1 is missing. To fix, install v1.3.1 or later. matrix-project v1.6 is missing. To fix, install v1.6 or later. Jenkins Workspace Cleanup Plugin v0.33 workflow-durable-task-step v2.4 is missing. To fix, install v2.4 or later. matrix-project v1.7.1 is missing. To fix, install v1.7.1 or later. resource-disposer v0.3 is missing. To fix, install v0.3 or later. structs v1.5 is missing. To fix, install v1.5 or later. Credentials Plugin v2.1.14 structs v1.7 is missing. To fix, install v1.7 or later. SSH Credentials Plugin v1.13 Credentials Plugin v2.1.14 failed to load. Fix this plugin first. Jenkins Git client plugin v2.4.6 Credentials Plugin v2.1.14 failed to load. Fix this plugin first. Jenkins Mailer Plugin v1.20 display-url-api v1.0 is missing. To fix, install v1.0 or later. Copy Artifact Plugin v1.38.1 matrix-project v1.3 is missing. To fix, install v1.3 or later.

PROBLEMS

  • On 'vagrant up' error:

    Vagrant attempted to execute the capability 'configure_networks'on the detect guest OS 'linux', but the guest doesn't support that capability. This capability is required for your configuration of Vagrant. Please either reconfigure Vagrant to avoid this capability or fix the issue by creating the capability.

    see https://stackoverflow.com/questions/38636023/vagrant-not-supported-the-capability-change-host-name.

  • On first Maven build error:

    Vagrantfile

    config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "1536"] end

    ssh

    export MAVEN_OPTS=-Xmx1024m

  • On Jenkins installation:

    ==> ci: err: /Stage[main]/Jenkins::Package/Package[jenkins]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install jenkins' returned 100: Reading package lists... ==> ci: Building dependency tree... ==> ci: Reading state information... ==> ci: Some packages could not be installed. This may mean that you have ==> ci: requested an impossible situation or if you are using the unstable ==> ci: distribution that some required packages have not yet been created ==> ci: or been moved out of Incoming. ==> ci: The following information may help to resolve the situation: ==> ci: The following packages have unmet dependencies: ==> ci: jenkins : Depends: default-jre-headless (>= 2:1.8) but it is not going to be installed or java8-runtime-headless but it is not installable ==> ci: E: Unable to correct problems, you have held broken packages.

Releases

No releases published

Packages

No packages published