AWS : Adding swap to a running instance

This is nothing but a summary of the following guide on how to add a swap volume to a running instance on AWS :

By default instances started on AWS do not have allocated swap memory … but u should ALWAYS add a swap mem to your running instance to avoid lack of memory overhead!

  1. Check if you have any swap on your instance
    swapon -s
  2. If none, create a volume and attach it to the instance (you will have to assign it a letter in the format ‘sdf’, ‘sdg’, … etc. The added volume will be mounted on ‘/dev/xvdf’, ‘/dev/xvdg’, … etc. Here the example is run on ‘sdg’ mounted on ‘/dev/xvdg’.
  3. Execute
    lsblk

    to check your device (example ‘/dev/xvdg’)

  4. format the device for swap using
    sudo mkswap /dev/xvdg
  5. then execute

    sudo swapon /dev/xvdg
    
  6. Re-execute

    swapon -s

    to see your swap created!

  7. Modify your ‘/etc/fstab’ and add the following line

    /dev/xdvg       none    swap    sw      0       0
    

    to make the mount of the device persistent.

Advertisements

Maven release plugin configuration on Jenkins

Maven configuration file settings.xml on the Jenkins server

Insert the following profile in the settings.xml that is on your Jenkins server:


<profile>
  <id>gitlab</id>
  <properties>
      <project.scm.id>gitlab</project.scm.id>
  </properties>
</profile>  

And insert the following server configuration in the same file


<server>
   <id>gitlab</id>
   <username>your-gitlab-username<username>
   <password>your-gitlab-password<password>
</server>

Job configuration on the Jenkins server

  1. Install the Maven Release Plug-in Plug-in
  2. Configure the build job to add the profile to the maven command line
    -Pgitlab

You can now enjoy performing releases from your Jenkins server.