Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

DevPI is no longer in use. See https://renalregistry.atlassian.net/wiki/spaces/ST/pages/1443200266/Python+Dependency+Management#Git-dependencies instead

Installing DevPi Server

  1. Preferred environment is Python 2.7 with pip, virtualenv installed.

  2. Install the server

    Code Block
    languagebash
    mkdir -p /opt/devpi/data
    cd /opt/devpi
    scl enable python27 bash
    virtualenv venv
    source venv/bin/activate
    pip install --upgrade pip
    pip -q -U devpi-server
  3. The data area needs to be initialised using

    Code Block
    languagebash
    cd /opt/devpi/
    source venv/bin/activate
    devpi-server --serverdir /opt/rh/devpi/data --init
  4. The server is run with the commands

    Code Block
    languagebash
    cd /opt/devpi/
    source env/bin/activate
    # Drop the --start to run in the forground
    # --stop --status --log also available 
    devpi-server --port 3141 --serverdir /opt/rh/devpi/data --start
    Warning
    titleRunning devpi in the background

    When running devpi in the foreground relative paths can be used for --serverdir however if using the --start option to run in the background a full path must be used or the service will fail to start.

  5. A proxy can be setup and it is assumed nginx will be used and the service runner needs to be set up to redirect to the devi-pi. Example configs (but not init.d) can be generated by running the devpi-server with --gen-config

  6. devpi is currently configured on the jira/bitbucket/confluence server using an apache proxy and is accessible at the following url https://devpi.renalregistry.nhs.uk

devpi-server is started and stopped using scripts in /opt/devpi/bin . These are called from an init.d  script located in /etc/init.d/devpi .

...

...

/etc/init.d/devpi
Code Block
languagebash
#!/bin/bash
#
# devpi        Startup script for the devpi server
#
# chkconfig: 2345 95 05
# description: devpi server for private package indexes and PyPI caching
#
# devpi Linux service controller script
cd "/opt/devpi/bin"

case "$1" in
    start)
        ./start-devpi.sh
        ;;
    stop)
        ./stop-devpi.sh
        ;;
    restart)
        ./stop-devpi.sh
        ./start-devpi.sh
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac
Info

The current set up of devpi server on the jira/Bitbucket server runs RedHat 6 and doesn't use the default httpd but uses httpd v2.4 which means it is installed via the the software collection and referenced as httpd24 with config files stored in /opt/rh/httpd24/root/etc/httpd  rather than the default path of /etc/httpd . 

Upgrading the Server

Code Block
/etc/init.d/devpi stop

cd /opt/devpi
scl enable python27 bash
source venv/bin/activate
pip install -U pip
pip install -U devpi-server

/etc/init.d/devpi start

...

Note

The version of Pip supplied with Python 3.6 no longer works with DevPi. Before following these steps upgrade it to the latest version.
Install a devpi client on your client machine

  1. Code Block
    languagebash
    pip install devpi-client
  2. Create a pip.ini file

    1. For your local machine:

      Code Block
      languagebash
      mkdir ~/pip
      cd ~/pip
      touch pip.ini
      cat > pip.ini                                                    
      [global]                                                         
      index_url = https://devpi.renalregistry.nhs.uk/ukrr/dev/+simple/          
                                                                       
      [search]                                                         
      index = https://devpi.renalregistry.nhs.uk/ukrr/dev/                      
      CTRL-D

      GS: Mine is in C:\Users\MY_USERNAME\AppData\Roaming\pip

    2. On rr-bamboo,

      1. for 32bit Python (27 and 36 in our case), add the pip.ini file to the
        C:\Windows\system32\config\systemprofile\pip
        folder

      2. For 64 bit Python (36 in our case), add the above pip.ini file to the
        C:\Windows\SysWOW64\config\systemprofile\pip
        folder

Configuring DevPi Server

  1. Create a root user:

    Code Block
    languagebash
    devpi use https://devpi.renalregistry.nhs.uk
    devpi login root --password ''
    devpi user -l
    devpi logoff
  2. Create a user named 'ukrr' with the following:

    Code Block
    languagebash
     devpi user -c ukrr password=registry email=rrsystems@renalregistry.nhs.uk
  3. Login and create the initial indices:

    Code Block
    languagebash
     devpi login ukrr --password=registry  
     devpi index -c ukrr/release bases=root/pypi ['volatile=False']
     devpi index -c ukrr/staging bases=ukrr/release ['volatile=False']
     devpi index -c ukrr/dev bases=ukrr/staging ['volatile=True']
  4. Initial seed of pips:

    Code Block
    devpi login ukrr
    devpi use  https://devpi.renalregistry.nhs.uk/ukrr/release/
    devpi upload --index ukrr/dev "R:\0 Software\Python\2.7_32bit\lxml-3.6.4-cp27-cp27m-win32.whl"
    devpi upload --index ukrr/dev "R:\0 Software\Python\2.7_32bit\pywin32-220.1-cp27-cp27m-win32.whl"
    devpi upload --index ukrr/dev "R:\0 Software\Python\2.7_32bit\pysvn-1.7.10-cp27-cp27m-win32.whl"
    devpi upload --index ukrr/dev "R:\0 Software\Python\2.7_32bit\PyQt4-4.11.4-cp27-none-win32.whl"


    The lxml, pywin32 and PyQt pips were obtained from http://www.lfd.uci.edu/~gohlke/pythonlibs/
    The pysvn pip has to be built using https://github.com/ferraith/pysvn-wheeler Instructions are contained in the download.

  5. I noticed when I uploaded pyinstaller 3.3 (for tpckd_validation, python 3.5), devpi refused to search the main indices for other versions of same modules. Setting up a mirror allowed access to the tip version, so if you want a previous version, this needs to be uploaded by hand. Fetch the source from pypi, and build the wheel using python setup.py bdist_wheel (remember to use the right version of python for the target wheel).

Filter by label (Content by label)
showLabelsfalse
max5
spacesINFRA
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "devpi" , "pip" , "linux" ) and type = "page" and space = "INFRA"
labelsdevpi pip linux

...

hiddentrue

...