Project

General

Profile

Working with PEM

Use environments

User environment configuration

You can set basis variable in ~/.pemrc.
For example :

directory=/opt/pem
uri=https://pem.csnsm.in2p3.fr:8080
sync=pem.csnsm.in2p3.fr:8081

You can also source bash_completion.d/pem :

. /opt/pem/bash_completion.d/pem

Working with an environment

To download a new environment, you have to check if the environment is available for your distribution :

you@localhost:> pem list envs --uri=https://pem.csnsm.in2p3.fr:8080
or
you@localhost:> pem list envs -u=https://pem.csnsm.in2p3.fr:8080
or
you@localhost:> pem list envs -r

If environment is available, you have to pull it :

you@localhost:> pem pull env ENV_NAME --uri=https:/pem.csnsm.in2p3.fr:8080 --sync=pem.csnsm.in2p3.fr:8081
or
you@localhost:> pem pull env ENV_NAME -u=https://pem.csnsm.in2p3.fr:8080 -s=pem.csnsm.in2p3.fr:8081
or
you@localhost:> pem pull env ENV_NAME

Use a downloaded environment

Under bash

You can source it :

. /opt/pem/bin/pem-source -d /opt/pem -e ENV_NAME
or
. /opt/pem/bin/pem-source -e ENV_NAME

Under tcsh

source /opt/pem/environments/env_name/x86_64/DISTRIB/last/cshrc

(!) You should override PEM_MAIN variable if your PEM directory isn't /opt/pem

setenv PEM_MAIN new_path

Build environments

Tools

Listing tools

Locally :
 ./bin/pem list tools
Remotely :
 ./bin/pem list tools -r

Pulling tools

/opt/pem/bin/pem pull tool_name -r

(!) Pulling tools bring associated products
(!) After a tool pull you should (re)generate all_products.graphml file

Pulling a list of tool in an environment

for i in $(grep tool= environments/env_name/products.graphml | awk '{print $3}' | sed -e 's/tool=\"//' | sed -e 's#\"/>##');do ./bin/pem pull tool $i -r ;done

Updating tools

/opt/pem/bin/pem update tool tool_name
or
/opt/pem/bin/pem update tool all
  • Updating a tar gz tool
/opt/pem/bin/pem update tool tool_name /path/to/tar_gz_file.tgz

Analyze mercurial repository to create tool

./bin/pem analyze hg uri_to_mercurial_repo

(!) Don't forget to update the new created tool

Generating all_products.graphml

/opt/pem/bin/pem generate file
or
/opt/pem/bin/pem generate file --png

Getting environment conf file

/opt/pem/bin/pem pull envconf env_name

Refresh environment product list

/opt/pem/bin/pem refresh env_name

Building an environment

/opt/pem/bin/pem build env_name

Remote build

If you want to have a remote build on arch / distrib you need to provide this file :
remote/arch/distrib

Here are a few examples :

  • On a real arm cpu (hostname => pc-utilite-1) with an ssh server listening on port 23
you@localhost> cat remote/armv7l/Raspbian-jessie
directory=/opt/pem
deploy_cmd=rsync -a $BUILD_DIR pem@pc-utilite-1:/tmp
push=rsync -aR $SOURCE pem@pc-utilite-1:
pull=rsync -a pem@pc-utilite-1:$SOURCE /opt/pem/
build_prefix=ssh -p 23 pem@pc-utilite-1
clean=ssh -p 23 pem@pc-utilite-1 rm -Rf /opt/pem/builds /opt/pem/environments /opt/pem/bin/armv7l
  • On a virtual machine running Ubuntu trusty
you@localhost> cat remote/x86_64/Ubuntu-trusty
watchdog=100
prepare=nova boot --flavor os.4 --image ubuntu14.04 --nic net-name=CSNSM-SI --poll --user-data /home/xavier/openstack-cli/pem/remote_pem_ubuntu.bash --key-name xgportable build_trusty_laptop
get_host_ip=/home/xavier/bin/nova_ip.bash build_trusty_laptop
check=/home/xavier/bin/check_cmd.bash build_trusty_laptop
check_result=1234/tcp open hotline
directory=/home/ubuntu/
deploy_cmd=rsync -a $BUILD_DIR ubuntu@$HOST_IP:/tmp
push=rsync -aR $SOURCE ubuntu@$HOST_IP:
pull=rsync -a ubuntu@$HOST_IP:$SOURCE /opt/pem/
build_prefix=ssh ubuntu@$HOST_IP
clean=nova delete build_trusty_laptop
  • On a chrooted distribution
you@localhost> cat remote/x86_64/Debian-jessie 
directory=/opt/pem
deploy_cmd=rsync -a $BUILD_DIR /chroot/jessie/tmp
push=rsync -aR $SOURCE /chroot/jessie/opt/pem
pull=rsync -a /chroot/jessie/opt/pem/$SOURCE /opt/pem/
build_prefix=schroot -d /opt/pem -c jessie --
clean=rm -Rf /chroot/jessie/opt/pem/builds /chroot/jessie/opt/pem/environments /chroot/jessie/opt/pem/tools

Remote build

./bin/pem build env_name --distrib=Debian-wheezy

Post build commands

After a build you can have some use of these commands :

  • Locally
    ./bin/pem list envs -l
    ./bin/pem list errors
    
  • After a remote build
    ./bin/pem list envs -l --distrib=Debian-wheezy
    ./bin/pem list errors --distrib=Debian-wheezy
    

PEM - Server

Launch

In pem depository directory :

./bin/pem-server -v

Files and directory needed for obsolete server

  • ./rsyncd.conf
  • .pem/
  • .pem/secrets
  • .pem/grp_envs
  • .pem/grp_users
  • .pem/sever.pem
  • keys/
  • keys/star_csnsm_in2p3_fr.crt
    • this file can contain any valid certificate but which can belong to another host
  • keys/star_csnsm_in2p3_fr.key
    • this file can contain any valid certificate but which can belong to another host