Here's where to get the code:
$ git clone https://github.com/abrt/faf.git
$ cd faf/
The remainder of the commands assume you're in the top level of the FAF git repository checkout.
It is possible to either build and run FAF locally or in container.
-
Install dependencies
# dnf builddep --spec faf.spec
-
Build
With all the dependencies installed, you can build the RPM package:
$ tito build --rpm --test
By default, tito uses /tmp/tito for output. You can install the resulting packages using
# rpm -Uvh /tmp/tito/noarch/faf-*.rpm
Prerequisite:
- Podman, see for example this guide
-
Change to container directory
$ cd container
-
Build the image
$ make build_local
-
Set up database
FAF requires a working relational database such as PostgreSQL. If not already done, set up a database for FAF and install the appropriate python connector package (e.g. python-psycopg2).
-
Initialize FAF
$ sudo -u faf faf-migrate-db --create-all $ sudo -u faf faf-migrate-db --stamp-only $ sudo -u faf faf init
-
Restart apache service
$ sudo service httpd restart
FAF should be available at http://localhost/faf/
Prerequisites:
-
Podman, see for example this guide
-
All following commands assume you are in container directory
In most cases it is enough to use official FAF database image
$ make run_db
This will also create a podman volume which is used for persistent DB storage and a podman pod which provides an environment for mutual communication among the containers mentioned further on.
If some changes were made in database, which cannot be solved with migration, a new database image must be built.
$ make build_db
An image thus built can be run the same way
$ make run_db
If local image was built with make build
then the image should be run with
$ make run_local
otherwise an official image can be run with
$ make run
You can log in to the FAF container by running
$ make sh
or to the database container by running
$ make sh_db
It is enough to run
$ make run_redis
This will download the redis docker image (if it isn't yet downloaded) and run it.
Now log in to the faf container by running
$ make sh
and start the faf-celery-worker
faf-celery-beat
services
$ faf-celery-worker start
$ faf-celery-beat start
Alternatively, you can run them on the local machine:
$ systemctl start faf-celery-worker.service
$ systemctl start faf-celery-beat.service
If using the local machine, make sure the database connection is properly set up in the [Storage]
section of /etc/faf/faf.conf
.
Once both the database and the faf containers have been built, you can create the podman volume (if it doesn't yet exist), the podman pod and run the db, faf and redis containers (in this order) by running
$ make run_all
or
$ make run_all_local
You can delete the redis, faf and db containers and the podman pod (in this order) by running
$ make del_all
You can delete the db, faf and db containers one by one by running make del_redis
, make del
and make del_db
respectively. Deleting the db container will also delete the podman pod. However, it will not delete the persistent storage. If you wish to delete it, you can do so by running.
$ podman volume rm faf-db-volume
- Set a
URL
to your server in/etc/libreport/plugins/ureport.conf
URL = http://localhost:8080/faf
- Create crash
- Make sure you have ABRT running and that you have auto-reporting enabled (
abrt-auto-reporting enabled
) - Install package
will-crash
and then executewill_abort
This should be enough, so in a few minutes (reports are processed every few minutes) you should see a spike in graph on your FAF. However there are few places where it can go wrong, therefore the following troubleshooting might be required:
-
Was the problem caught by ABRT on your local machine?
Check output of
abrt-cli ls
. If you dont see any problems there, ABRT is probably not running on your machine. Check https://abrt.readthedocs.io/en/latest/ for more information. -
Was the problem sent to FAF?
Check content of
/var/spool/faf/reports
. In there you should be able to find a file whose name consists of numbers and letters.(If you are running FAF in container, you will need to check this from the inside of the container. You can switch to the container's bash by running
$ make sh
from container directory.)For example, you can execute
find /var/spool/faf/reports/
and output should look something like this/var/spool/faf/reports/ /var/spool/faf/reports/saved /var/spool/faf/reports/saved/6ab72295-cc09-4e15-af52-e818f6920314 /var/spool/faf/reports/archive /var/spool/faf/reports/incoming /var/spool/faf/reports/deferred
If there is no such file, it means that the report was not sent automatically or it was sent to a wrong server. Go to the
/var/spool/abrt/cccp-...
directory on your local machine and executereporter-ureport -vvv
. From the output you should be able to see if it was successfully sent and to which server. After that you should be able to see a new file in/var/spool/faf/reports/incoming
. -
Was the problem automatically processed on the server?
If you see the file in
/var/spool/faf/reports/incoming
it means the report was not processed. Just runsudo -E -u faf faf save-reports
.
Note: Instead of the first two steps you can just copy this
file into
var/spool/faf/reports/incoming
Easiest way how to test everything (build, run tests, check lints) is to make rpm build (see, 2. Build from source in Building locally chapter) or to make local image build.
For running only tests change to tests directory and execute
unit2
If you want to run only specific test, you can do so by simply executing it, for example
./test_actions
For running only pylint, change to src directory and execute
pylint-3 --rcfile=../pylintrc $(find ./ -name *.py) webfaf/hub.wsgi bin/faf-migrate-db bin/faf
-
Fork the FAF repository (hit fork button on https://github.com/abrt/faf)
-
Clone your fork
-
Checkout to a new branch in your clone (
git checkout -b <name_of_branch>
) -
... make changes...
-
Test your changes
-
Create tests for the given changes
-
Add edited files (
git add <file_name>
) -
Create commit (
git commit
) How to write a proper git commit message
Note: You can set up a helpful commit message template for your text editor by running$ git config commit.template .git-commit-template
. Remember though that committing withgit commit -m
defeats its purpose. You might want to rethink your habits. -
Push your branch (
git push -u origin <name_of_branch>
) -
Go to https://github.com/abrt/faf and click
Create pull request
-
Create the PR
-
Wait for review