Skip to content

Latest commit

 

History

History
107 lines (76 loc) · 2.97 KB

README.server.markdown

File metadata and controls

107 lines (76 loc) · 2.97 KB

Server setup

The server is using in Python, using the Flask web framework and SQLAlchemy for the models.

To install the server in a virtualenv do the following:

Clone the repository

Create the virtualenv and activate it

$ virtualenv vpopcorn
$ source vpopcorn/bin/activate

You will need the postgresql and python development files to install psycopg2 which is a required dependency for popcorn you should install this using your distribution's package manager. Example: zypper install gcc python-devel postgresql-devel

Set up your development environment. This will add the popcorn package to your python path, but will not install it anywhere else. You can now edit the files in the git clone directory and the changes will be immediately visible to the server.

$ cd popcorn
$ ./setup.py develop

You can check that the unittests run fine

$ ./setup.py test

Setup the database

Install and setup postgresql-server for your distribution, then turn it on. Create the popcorn user and database.

$ su - postgres
$ createuser popcorn -P
Enter password for new role: <enter popcorn as the password>
Enter it again: <popcorn again>
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
$ createdb popcorn --owner=popcorn

If you've set different values here than the default, edit DB_ENGINE in popcorn/configs.py and set them there as well

Setup the database to use md5 authentication for local users by editing your system's pg_hba.conf file and replacing these lines:

# "local" is for Unix domain socket connections only
local   all         all                               ident sameuser
# IPv4 local connections:
host    all         all         127.0.0.1/32          ident sameuser

with these:

# "local" is for Unix domain socket connections only
local   all         all                               md5
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5

Initialize the database (installs tables and initial data).

Start the server with the --debug flag (changes to files will cause the server to reload them immediately + nice traceback pages)

$ ./server/popcorn-server --debug
 * Running on http://127.0.0.1:5000/
 * Restarting with reloader

You can now point your browser to http://127.0.0.1:5000/ (there won't be much to see).

Client

In order to test the client, you will need to have the python-rpm package installed. It's easier to do this from outside the virtualenv, because virtualenv will hide your system's site-packages by default (and this is also how popcorn-client will run in the wild).

$ POPCORN_ENABLED=1 ./popcorn-client 
Submission received. Thanks!

If you now look on the popcorn webUI, you should see a lot of data about your currently installed packages.