2022-12-13 15:58:13 +01:00
|
|
|
|
.. _exploring_the_development_environment:
|
|
|
|
|
|
|
|
|
|
Exploring the development environment
|
2023-11-16 08:02:56 +10:00
|
|
|
|
=====================================
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
This document will go through all repositories of Badges project and describe the state
|
|
|
|
|
of development environment and how it could be improved.
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
|
|
|
|
Tahrir
|
2023-11-16 08:02:56 +10:00
|
|
|
|
------
|
|
|
|
|
|
|
|
|
|
`Tahrir <https://github.com/fedora-infra/tahrir>`_ is a Fedora badges frontend. The
|
|
|
|
|
guide for setting up development environment is described in `DEVELOPING.md
|
|
|
|
|
<https://github.com/fedora-infra/tahrir/blob/develop/DEVELOPING.md>`_ and it's using
|
|
|
|
|
`Vagrant <https://www.vagrantup.com/>`_.
|
|
|
|
|
|
|
|
|
|
Vagrantfile.example is using F29, which is no longer available. Updated this to F36, but
|
|
|
|
|
encountered issue when tried to provision the machine by ansible `Failed to connect to
|
|
|
|
|
the host via ssh: Shared connection to xxx.xxx.xxx.xxx closed.` Solved by defining the
|
|
|
|
|
domain of VM in Vagrantfile:
|
|
|
|
|
|
|
|
|
|
.. code-block::
|
|
|
|
|
|
|
|
|
|
config.vm.define "tahrir" do |tahrir|
|
|
|
|
|
tahrir.vm.host_name = "tahrir.example.com"
|
|
|
|
|
|
|
|
|
|
tahrir.vm.provider :libvirt do |domain|
|
|
|
|
|
# Season to taste
|
|
|
|
|
domain.cpus = 4
|
|
|
|
|
domain.graphics_type = "spice"
|
|
|
|
|
domain.memory = 2048
|
|
|
|
|
domain.video_type = "qxl"
|
|
|
|
|
end
|
2022-12-13 15:58:13 +01:00
|
|
|
|
end
|
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
The installation of the tahrir needed a specific version of setuptools (57.5.0), later
|
|
|
|
|
version doesn’t have 2to3 in it.
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
The provisioning steps in the ansible needed to be done manually, because of this
|
|
|
|
|
setuptools issue. Installation in a virtual environment inside the vagrant machine was
|
|
|
|
|
finished successfully.
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
Initialization of the database failed on `ImportError: cannot import name
|
|
|
|
|
'ZopeTransactionExtension' from 'zope.sqlalchemy'`. To get over this I needed to remove
|
|
|
|
|
`extension=ZopeTransactionExtension()` and corresponding import from
|
|
|
|
|
`.venv/lib64/python3.8/site-packages/tahrir_api-0.8.1-py3.8.egg/tahrir_api/model.py`.
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
Next issue during the initialization of DB was `ModuleNotFoundError: No module named
|
|
|
|
|
'utils'` Fixed this by adding `.` before local imports in
|
2022-12-13 15:58:13 +01:00
|
|
|
|
`.venv/lib64/python3.8/site-packages/tahrir_api-0.8.1-py3.8.egg/tahrir_api/dbapi.py`
|
|
|
|
|
This was the end of the provisioning phase.
|
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
When trying to run `pserve --reload development.ini` I ended up with error `TypeError:
|
|
|
|
|
SignedCookieSessionFactory() got an unexpected keyword argument 'cookie_secure'` Fixed
|
|
|
|
|
by removing `cookie_` prefix from `SignedCookieSessionFactory` call in
|
|
|
|
|
`/vagrant/tahrir/__init__.py`
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
Another error `ImportError: cannot import name 'authenticated_userid' from
|
|
|
|
|
'pyramid.security' (unknown location)` Fixed this by changing the dependency `pyramid <
|
|
|
|
|
2.0` in `setup.py` See https://github.com/stevearc/pypicloud/issues/274 for more info
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
After that the instance is running, but it’s not accessible outside of the VM. When
|
|
|
|
|
trying curl http://0.0.0.0:8000 it throws error `TypeError: __init__() got an unexpected
|
|
|
|
|
keyword argument 'extension'`
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
At this point we wouldn't want to put more effort in it, because it means starting to
|
|
|
|
|
fix issues in app itself and this is not part of the investigation.
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
|
|
|
|
Recommendation
|
2023-11-16 08:02:56 +10:00
|
|
|
|
~~~~~~~~~~~~~~
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
|
|
|
|
Before fixing the development environment Tahrir needs to be updated to python 3.0, so
|
|
|
|
|
it could run no never versions of Fedora.
|
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
The development environment itself could be used with few enhancements. See
|
|
|
|
|
investigation above.
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
|
|
|
|
tahrir_api
|
2023-11-16 08:02:56 +10:00
|
|
|
|
----------
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
|
|
|
|
tahrir_api is part of Fedora Badges backend and provides API and database to work with.
|
2023-11-16 08:02:56 +10:00
|
|
|
|
The guide for setting up development environment is available in `README
|
|
|
|
|
<https://github.com/fedora-infra/tahrir-api#readme>`_ and it's using Python virtual
|
|
|
|
|
environment.
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
|
|
|
|
The guide is working without issue, but it's missing any tools to work with tahrir_api
|
|
|
|
|
itself.
|
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
**Recommendation**
|
|
|
|
|
Provide guide or tools to work with standalone tahrir_api in development
|
|
|
|
|
environment.
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
|
|
|
|
fedbadges
|
2023-11-16 08:02:56 +10:00
|
|
|
|
---------
|
2022-12-13 15:58:13 +01:00
|
|
|
|
|
|
|
|
|
fedbadges is part of Fedora Badges backend and provides consumer for fedmsg messages.
|
|
|
|
|
There is no guide or any description of development environment.
|
|
|
|
|
|
2023-11-16 08:02:56 +10:00
|
|
|
|
**Recommendation**
|
|
|
|
|
Create a development environment that allows you to work with fedbadges and document
|
|
|
|
|
it.
|