• Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Medium Medium
    • Beijing Release
    • None
    • None
    • OOM Sprint 6

      https://hub.docker.com/r/jenkins/jenkins/

      We are on rackspace instead of aws for the servers - kill the following taking 5 cpus

      22132 root      20   0  163220  37992    412 S 525.0  0.5   4066:38 eyshcjdmzg                                                                                                                         

      12154 gitlab-+  20   0  728504  71516  23192 S   6.2  0.9   0:13.90 prometheus                                                                                                                         root@gitlab:~# sudo kill -9 22132

       

      using AWS EC2

      https://docs.docker.com/engine/admin/volumes/volumes/#start-a-container-with-a-volume 

      https://github.com/jenkinsci/docker/issues/177 

      https://github.com/ruslo/polly/wiki/Jenkins-(creating-user-on-linux-ubuntu) 

      https://askubuntu.com/questions/645236/command-to-list-all-users-with-their-uid 

       Docker
      /var/jenkins_home/workspace/oom-cd
       Host

      /home/jenkins/workspace/oom-cd

      https://wiki.jenkins.io/display/JENKINS/Publish+Over+SSH+Plugin 

      root@ip-172-31-90-28:~#  sudo useradd --home-dir /home/jenkins --create-home --shell /bin/bash jenkins
      root@ip-172-31-90-28:~# sudo passwd jenkins
      
      root@ip-172-31-90-28:~# awk -F: '/\/home/ {printf "%s:%s\n",$1,$3}' /etc/passwd
      syslog:104
      ubuntu:1000
      jenkins:1001
      
      root@ip-172-31-90-28:~# docker run -u 1001 -d --name jenkins -p 80:8080 -p 50000:50000  -it -v /home/jenkins:/var/jenkins_home  jenkins/jenkins:lts
      0e48549d03a9dac098644728e0fec4ee23ed00724bbb6e9c2b24c8ddfbfc199a
      root@ip-172-31-90-28:~# docker ps
      CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                                            NAMES
      0e48549d03a9        jenkins/jenkins:lts   "/bin/tini -- /usr..."   5 seconds ago       Up 4 seconds        0.0.0.0:50000->50000/tcp, 0.0.0.0:80->8080/tcp   jenkins
      
      root@ip-172-31-90-28:~# free
                    total        used        free      shared  buff/cache   available
      Mem:       15657380     1625624    11355580        8904     2676176    13660616
      Swap:             0           0           0
      
      https://wiki.jenkins.io/display/JENKINS/Publish+Over+SSH+Plugin
      configure ssh server in manage jenkins | configure system
      add build step to job
      chmod 777 the pem file
      root@ip-172-31-90-28:/home/jenkins/workspace# chmod 777 ob.pem
      
      6:37:41 Started by user admin
      16:37:41 Building in workspace /var/jenkins_home/workspace/oom-cd
      16:37:41 SSH: Connecting from host [0e48549d03a9]
      16:37:41 SSH: Connecting with configuration [ubuntu@dev.onap.info] ...
      16:37:41 SSH: EXEC: STDOUT/STDERR from command [free] ...
      16:37:41               total        used        free      shared  buff/cache   available
      16:37:41 Mem:       62879948    43669236      477080      710116    18733632    17263732
      16:37:41 Swap:             0           0           0
      16:37:41 SSH: EXEC: completed after 201 ms
      16:37:41 SSH: Disconnecting configuration [ubuntu@dev.onap.info] ...
      16:37:41 SSH: Transferred 0 file(s)
      16:37:41 Build step 'Send files or execute commands over SSH' changed build result to SUCCESS
      16:37:41 Finished: SUCCESS
      
      
      workaround to run a root sh from ubuntu user from the jenkins server
      on jenkins job
      
      exec-command = sudo /home/ubuntu/run_cd.sh
      
      -rwsr-xr-x 1 root   root     51 Nov 11 16:54 run_cd.sh
      on ec2 cd server ubuntu
      in run_cd.sh
        cd /root
        sudo /root/cd.sh
      
      ubuntu@ip-172-31-82-46:~$ sudo chown root.root run_cd.sh 
      ubuntu@ip-172-31-82-46:~$ sudo chmod 4755 run_cd.sh 
      ubuntu@ip-172-31-82-46:~$ ls -la
      
      on ec2 cd server root
      /root/cd.sh
      
      
      16:58:52 SSH: EXEC: STDOUT/STDERR from command [sudo /home/ubuntu/run_cd.sh] ...
      16:58:52 start
      16:58:52 /root
      
      
      for root on rackspace
      root@jenkins:~# docker run -u 1001 -d --name jenkins -p 80:8080 -p 50000:50000  -it -v /home/jenkins:/var/jenkins_home  jenkins/jenkins:lts
      root@jenkins:~# sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
      root@jenkins:~# sudo iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
      root@jenkins:~# sudo iptables -I INPUT 1 -p tcp --dport 50000 -j ACCEPT
      
      

            michaelobrien michaelobrien
            michaelobrien michaelobrien
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h