There are two ways to bootstrap a Bodhi development environment. You can use Vagrant, or you can use virtualenv on an existing host.
Vagrant allows contributors to get quickly up and running with a Bodhi development environment by automatically configuring a virtual machine. To get started, simply use these commands:
$ sudo dnf install ansible vagrant-libvirt vagrant-sshfs
$ cp Vagrantfile.example Vagrantfile
# Make sure your bodhi checkout is your shell's cwd
$ vagrant up
$ vagrant ssh -c "cd /vagrant/; pserve development.ini --reload"
You can ssh into your running Vagrant box like this:
# Make sure your bodhi checkout is your shell's cwd
$ vagrant ssh
Keep in mind that all vagrant
commands should be run with your current working directory set to your Bodhi checkout. The code from your development host will be mounted in /vagrant
in the guest. You can edit this code on the host, and the vagrant-sshfs plugin will cause the changes to automatically be reflected in the guest's /vagrant
folder.
You can run the unit tests within the guest with nosetests:
$ cd /vagrant
$ nosetests -v
You can run the development server from inside the Vagrant environment:
$ pserve /vagrant/development.ini --reload
When you are done with your Vagrant guest, you can destroy it permanently by running this command on the host:
$ vagrant destroy
Virtualenv is another option for building a development environment.
sudo dnf install libffi-devel postgresql-devel openssl-devel koji pcaro-hermit-fonts freetype-devel libjpeg-turbo-devel python-pillow zeromq-devel
sudo dnf -y install python-virtualenvwrapper python-createrepo_c
Add the following to your `~/.bashrc`:
export WORKON_HOME=$HOME/.virtualenvs
source /usr/bin/virtualenvwrapper.sh
Add the following to your ~/.bashrc
export PYTHONPATH=$PYTHONPATH:$HOME/.virtualenv
Then on the terminal :
source ~/.bashrc
git clone https://github.com/fedora-infra/bodhi.git
cd bodhi
./bootstrap.py
workon bodhi-python2.7
python setup.py develop
pip install psycopg2
Create the development.ini file
Copy development.ini.example
to development.ini
: :
cp development.ini.example development.ini
python setup.py test
curl -O https://infrastructure.fedoraproject.org/infra/db-dumps/bodhi2.dump.xz
sudo -u postgres createdb bodhi2
xzcat bodhi2.dump.xz | sudo -u postgres psql bodhi2
Note
If you do not have a PostgreSQL server running, please see the instructions at the bottom of the file.
Adjust database configuration in development.ini file
Set the configuration key sqlalchemy.url to point to the postgresql database. Something like: :
sqlalchemy.url = postgresql://postgres:anypasswordworkslocally@localhost/bodhi2
alembic upgrade head
pserve development.ini --reload
dnf install postgresql-server
As a privileged user on a Fedora system run the following: :
sudo postgresql-setup initdb
As a privileged user on a Fedora system modify the pg_hba.conf file: :
vi /var/lib/pgsql/data/pg_hba.conf
Then adjust the content at the bottom of the file to match the following.
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections are *trusted*, any password will work.
host all all 127.0.0.1/32 trust
# IPv6 local connections are *trusted*, any password will work.
host all all ::1/128 trust
If you need to make other modifications to postgresql please make them now.
As a privileged user on a Fedora system run the following: :
sudo systemctl start postgresql.service
There is a meeting every four weeks between Bodhi developers and stakeholder, held on IRC. If you would like to attend, you can see details here: