Skip to content

Instantly share code, notes, and snippets.

@zhangsen
Created December 5, 2011 04:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zhangsen/1432328 to your computer and use it in GitHub Desktop.
Save zhangsen/1432328 to your computer and use it in GitHub Desktop.
conary repo setup

conary repo setup

References

Prepare

Hook to apache

  • write /etc/httpd/conf.d/python-conary.conf (named python-conary.conf so that it's started after mod_python's python.conf) (suppose we want to put the mirror under /srv/conary)

      # cat /etc/httpd/conf.d/python-conary.conf
      Alias /conary/ "/srv/conary/config/repository.cnr/"
    
      <Directory /srv/conary/config/>
          AddHandler python-program .cnr
          PythonHandler conary.server.apachehooks
      </Directory>
    
      # You may also find it useful to redirect /conary to /conary/, but if you
      # do, make sure you have trailing slashes in your repository Map entries.
      RedirectMatch /conary$ /conary/
    

Setup repository

  • mkdir -p /srv/conary/{config,contents,db,tmp}

  • write /srv/conary/config/repository.cnr

      # cat /srv/conary/config/repository.cnr
      repositoryDB sqlite /srv/conary/db/sqldb
      contentsDir /srv/conary/contents
      tmpDir /srv/conary/tmp
    
      readOnlyRepository true
    
      # this is the hostname part of the label, not the hostname of the machine
      # so on both conary.rpath.com and on conary-mirror.rpath.com, this
      # is "serverName conary.rpath.com".  This can also be a list if your repository
      # serves more than one label.
      serverName jesse.rpath.org
    
  • create users

      /usr/lib64/python2.7/site-packages/conary/server/server.py --add-user admin --admin --config-file  /srv/conary/config/repository.cnr
      /usr/lib64/python2.7/site-packages/conary/server/server.py --add-user anonymous --config-file  /srv/conary/config/repository.cnr
    
  • ensure the db and the dirs are writable by apache

      chown :apache /srv/conary/db/sqldb /srv/conary/tmp/ /srv/conary/contents/ /srv/conary
      chmod g+w /srv/conary/db/sqldb /srv/conary/tmp/ /srv/conary/contents/ /srv/conary/
    
  • install conary-web-common (ftp://download.rpath.com/pub/rpath/conary/conary-web-common-1.0.tar.bz2)

  • touch /usr/share/conary/web-common/css/custom.css # to get rid of a 404 warning

Do mirror

After the repository is set up, you could mirror another repository into this one.

Suppose the hostname of the your server is repo.test.org, and you want to mirror jesse.rpath.org. Your repository should have been configured to serve jesse.rpath.org (serverName in the above repository.cnr).

  • write a mirror.conf

      # cat do-mirror/mirror.conf 
      host jesse.rpath.org
    
      [source]
      user jesse.rpath.org jesse XXXXX
    
      [target]
      user jesse.rpath.org admin XXXXX
      repositoryMap jesse.rpath.org http://repo.test.org/conary/
    
  • populate it

      /usr/share/conary/mirror -v --config-file mirror.conf
    

Possible problems

  • Make sure the database file and the directory are writable (and the directory is executable/searchable) by apache. Or else there might be:

      DatabaseError: unable to open database file
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment