=======
INSTALL
=======

configuration
-------------

This package contains a configuration script which is not usual in a 
distribution package like this. The configure script can be used for initialize
or change the server configuration before or after you installed this package.

the recommented steps are::

  - python configure.py

  - python bootstrap.py

  - bin/buildout (on *nix) or bin\buildout.exe (on windows)

The configure.py is required by buildout.cfg. The configure.py script allows
you to choose devmode, localhost, port and management user login settings. All
the collected values get written to the app.cfg file which is included in
buildout.cfg.

If you don't like to use the configure.py script at any time, we recommend to
write your own app.cfg e.g. myapp.cfg and include them in buildout.cfg
``extends`` and exclude the existing app.cfg. This will prevent you from
override the app.cfg by using the configure.py script.


step by step
------------

First checkout the mypypi package from pypi.python.org and store it on your
mypypi server.

As next, before we call ``python bootstrap.py``, run the configure.py script
with the following command::

  python configure.py

This will ask you for some input like::

  Would you like to setup with devmode (y/n): y
  Choose your server hostname: localhost
  Choose your server port: 8080
  Note:
  Distutils does not work with a port other then 80.
  Use a proxy server running at port 80 for access the
  MyPyPi server at port 8080

  Choose a managment user login: Manager
  Choose a management user password: password
  Choose a password encryption (plain/md5/sha1): plain
  Generated configuration file 'app.cfg'

  ---------------------------------------------------------------
  New buildout configuration files successfully created
  You have to run bootstrap and buildout now

  After running buildout there is a configure script installed
  You can run this counfiguration script again with bin/configure
  ---------------------------------------------------------------

After setup the app.cfg file within the configure.py script, you can run
bootstrap.py as usual with the following command::

  python bootstrap.py

After bootstrap you can run buildout as usual with the following command::

  bin/buildout

After setup your mypypi server with buildout, you can test your installation
with the following command::

  bin/test -py1

There is also a coverage recipe installed which you can use as usual with the
following commands::

  bin/coverage-test
  bin/coverage-report

After running the converage scripts, you can see the generated coverage report 
in the new generated ``coverage/report`` folder. There should be an all.html
file which you can start with.

Congratulations, you just configured and installed your mypypi server. If you 
like to use another ip/port, devmode or manager user login, you can just
reconfigure your setup with calling configure again with the following command::

  python configure.py

This will again ask you for some input like::

  Would you like to setup with devmode (y/n): y
  Choose your server hostname: localhost
  Choose your server port: 8080
  Note:
  Distutils does not work with a port other then 80.
  Use a proxy server running at port 80 for access the
  MyPyPi server at port 8080

  Choose a managment user login: Manager
  Choose a management user password: password
  Choose a password encryption (plain/md5/sha1): plain
  Generated configuration file 'app.cfg'

  ---------------------------------------------------------------
  New buildout configuration files successfully created
  You have to restart your server now
  ---------------------------------------------------------------

Recognize the note in the generated output. Your new app.cfg configuration file
will only get used after you restart the mypypi server.

After you reconfigured your server, the old configuration file called
``app.cfg`` get renamed to ``app.cfg-<year><month><day>-<hour>-<minute>``
This means you can simply revert your changes if you rename an old app.cfg*
file to app.cfg and restart your server.


start
-----

Now you can start your new mypypi server with the following command::

  bin/app


nix
---

We recommend to use spervisord as a autostart option for mypypi. But any other
concept like using a init.d script should work for mypypi. A simple supervisord
programm like this should work:

  [program:mypypi]
  directory = <mypypi root path>
  command = <mypypi root path>/bin/app
  priority = 10
  autostart = true
  autorestart = true


windows
-------

There is also a windows service installation script. You can simply run the
windows service installation with the following command::

  python bin\winservice.py install

You can also remove the service with the following command::

  python bin\winservice.py remove

run the follwoing command windows service management for more options::

  python bin\winservice.py help

After install your service, go to the serivce controll panel and check the 
service configuration. The service get installed as ``MYPYPI Windows Service``.
If you like to rename the service make sure you removed a previous service
installation, change winservice configuration section in buildout.cfg and
run buildout again. After that install your service again like described above.
Changing your winservice configuration in buildout.cfg should be compatible
with the configure.py script concept like any other option in buildout.cfg.
