From 952688c936c9567e0b3d0f5299cdf9b99daebc94 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 19 2020 18:41:59 +0000 Subject: [PATCH 1/2] Drop the use of virtualenv in the vagrant box Use plain RPM provided by Fedora instead. Signed-off-by: Pierre-Yves Chibon --- diff --git a/dev/ansible/roles/pagure-dev/files/bashrc b/dev/ansible/roles/pagure-dev/files/bashrc index 28f45f1..d1fb29e 100644 --- a/dev/ansible/roles/pagure-dev/files/bashrc +++ b/dev/ansible/roles/pagure-dev/files/bashrc @@ -5,8 +5,7 @@ if [ -f /etc/bashrc ]; then . /etc/bashrc fi -# Always use the virtualenv -workon python3-pagure +cat /etc/motd # To avoid confusion, start in the `devel` directory cd devel diff --git a/dev/ansible/roles/pagure-dev/files/motd b/dev/ansible/roles/pagure-dev/files/motd index 53abeee..d30f2e1 100644 --- a/dev/ansible/roles/pagure-dev/files/motd +++ b/dev/ansible/roles/pagure-dev/files/motd @@ -3,18 +3,13 @@ Welcome to the Pagure development environment! Here are some tips: -* Pagure is installed in a Python virtualenv. Use `deactivate` to leave it, - or `workon python3-pagure` to get back in. * The code for Pagure is located at ~/devel/ - * You can populate the database with `python dev-data.py --all` - * Logs for the server are available with `journalctl`; the services are run as systemd user units in ~/.config/systemd/user/ -* To run the tests you need python3 virtualenv: `workon python3-pagure`. - Then you can run them with `./runtests.py run`. +* To run the tests run: `~/devel/runtests.py run`. Here is a list of command and alias you may find useful: diff --git a/dev/ansible/roles/pagure-dev/files/pagure.service b/dev/ansible/roles/pagure-dev/files/pagure.service index eca15db..aedda80 100644 --- a/dev/ansible/roles/pagure-dev/files/pagure.service +++ b/dev/ansible/roles/pagure-dev/files/pagure.service @@ -4,7 +4,7 @@ After=network.target [Service] Environment="PAGURE_CONFIG=/home/vagrant/pagure.cfg" -ExecStart=/home/vagrant/.virtualenvs/python3-pagure/bin/python %h/devel/runserver.py --host 0.0.0.0 --debug +ExecStart=python3 %h/devel/runserver.py --host 0.0.0.0 --debug Type=simple [Install] diff --git a/dev/ansible/roles/pagure-dev/tasks/main.yml b/dev/ansible/roles/pagure-dev/tasks/main.yml index e48adbc..7198069 100644 --- a/dev/ansible/roles/pagure-dev/tasks/main.yml +++ b/dev/ansible/roles/pagure-dev/tasks/main.yml @@ -21,16 +21,12 @@ - name: Install Pagure development packages dnf: name: - - gcc - - libgit2-devel - - libffi-devel - - libjpeg-devel - - make - python3-alembic - python3-arrow - python3-binaryornot - python3-bleach - python3-blinker + - python3-celery - python3-chardet - python3-cryptography - python3-docutils @@ -41,8 +37,10 @@ - python3-jinja2 - python3-markdown - python3-munch + - python3-mock - python3-openid-cla - python3-openid-teams + - python3-pillow - python3-pip - python3-psutil - python3-pygit2 @@ -53,10 +51,9 @@ - python3-wtforms - python3-devel - python3-devel - - redhat-rpm-config - python3-bcrypt - - python3-virtualenv - state: present + - redhat-rpm-config + state: latest # Add various helpful configuration files - name: Install a custom bashrc @@ -78,56 +75,6 @@ become_user: "{{ ansible_env.SUDO_USER }}" copy: src=bash_history dest=/home/{{ ansible_env.SUDO_USER }}/.bash_history -- name: register the libgit2 version installed - shell: rpm -q libgit2|cut -d \- -f 2| cut -d \. -f 1,2 - register: libgit2_version - args: - warn: false - -# Install Pagure inside a virtualenv and configure it -- name: Install pygit2 in the virtualenv - become_user: "{{ ansible_env.SUDO_USER }}" - pip: - name: - - "pygit2=={{ libgit2_version.stdout_lines[0] }}.*" - virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/ - virtualenv_python: python3 - virtualenv_command: virtualenv - -- name: Install Pagure Python dependencies into a virtualenv - become_user: "{{ ansible_env.SUDO_USER }}" - pip: - requirements: /home/{{ ansible_env.SUDO_USER }}/devel/{{ item }} - virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/ - virtualenv_command: virtualenv - virtualenv_python: python3 - virtualenv_site_packages: yes - extra_args: --no-use-pep517 - with_items: - - "requirements.txt" - - "requirements-ev.txt" - - "requirements-testing.txt" - -- name: Hotfix python-fedora to make flask_fas_openid compatible with flask >= 1.0 - become: "{{ ansible_env.SUDO_USER }}" - lineinfile: - path: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/lib/python3.7/site-packages/flask_fas_openid.py - regexp: '^ if assume_recent or \(major >' - line: ' if assume_recent or (major > 0 or minor >= 10):' - -- name: Install Pagure package into a virtualenv - become_user: "{{ ansible_env.SUDO_USER }}" - pip: - name: /home/{{ ansible_env.SUDO_USER }}/devel/ - extra_args: '-e' - virtualenv: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/ - virtualenv_command: virtualenv - -- name: Install Pagure package into /usr/lib - pip: - name: /home/{{ ansible_env.SUDO_USER }}/devel/ - extra_args: '-e' - - name: Install the pagure configuration become_user: "{{ ansible_env.SUDO_USER }}" copy: src=pagure.cfg dest=/home/{{ ansible_env.SUDO_USER }}/pagure.cfg @@ -166,14 +113,14 @@ - name: Create the Pagure database become_user: "{{ ansible_env.SUDO_USER }}" - command: .virtualenvs/python3-pagure/bin/python devel/createdb.py + command: python3 devel/createdb.py args: creates: /home/{{ ansible_env.SUDO_USER }}/pagure_data/pagure_dev.sqlite chdir: "/home/{{ ansible_env.SUDO_USER }}/" - name: Stamp the database with its current migration become_user: "{{ ansible_env.SUDO_USER }}" - shell: /home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/bin/alembic stamp $(/home/{{ ansible_env.SUDO_USER }}/.virtualenvs/python3-pagure/bin/alembic heads | awk '{ print $1 }') + shell: PYTHONPATH=/home/{{ ansible_env.SUDO_USER }}/devel/ alembic-3 stamp $(PYTHONPATH=/home/{{ ansible_env.SUDO_USER }}/devel/ alembic-3 heads | awk '{ print $1 }') args: chdir: "/home/{{ ansible_env.SUDO_USER }}/" From 03a9c941029f96df4710a69ef0a61eaba3cc18d0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 19 2020 18:41:59 +0000 Subject: [PATCH 2/2] Always show the useful commands Signed-off-by: Pierre-Yves Chibon --- diff --git a/dev/ansible/roles/pagure-dev/files/bashrc b/dev/ansible/roles/pagure-dev/files/bashrc index d1fb29e..8e987c0 100644 --- a/dev/ansible/roles/pagure-dev/files/bashrc +++ b/dev/ansible/roles/pagure-dev/files/bashrc @@ -5,7 +5,11 @@ if [ -f /etc/bashrc ]; then . /etc/bashrc fi -cat /etc/motd +echo "Reminder of the commands: + * pstart: to start all the services + * pstop: to stop all the services + * prestart: to restart all the services + * plog: to access the logs of the 'pagure' service (the web server)" # To avoid confusion, start in the `devel` directory cd devel