Commit graph

25 commits

Author SHA1 Message Date
Alex Pyrgiotis
d1afe4c30a
Fix Podman crashes due to old conmon version
Switching from mounting files to writing to stdout has introduced some
Podman crashes in specific environments (Ubuntu Jammy / Debian Bullseye)
due to a conmon bug that affects version 2.0.25.

Fixing it for various permutations of the environments we support
requires the following:

1. CI tests: Install conmon from the oldstable-proposed-updates in
   our Debian Bullseye / Ubuntu Jammy dev/end-user environments.
2. Developers: Add a line in BUILD.md that suggests users to install
   conmon from the oldstable-proposed-updates repo, or some other repo
   they prefer.
3. End-user installations: We will build conmon for Ubuntu Jammy, and
   wait until the proposed updates repo gets merged in Debian Bullseye.

Fixes #685
2024-02-07 12:53:15 +00:00
Alex Pyrgiotis
b0da1dde5f
dev_scripts: Build end-user Fedora env with PySide6
Extend the env.py script to build an end-user, Fedora 39+ environment
with PySide6 installed, as a regular RPM package. Previously, this was
only possible for development environments with PySide6 downloaded from
PyPI.

As a way to simplify builds, the env.py script offers the option to
download the RPM package itself from FPF's RPM repo [1], if the package
has been uploaded.

[1]: https://packages.freedom.press/yum-tools-prod
2024-01-31 17:11:30 +02:00
Alex Pyrgiotis
84037d4ffb
dev_scripts: Return exit code for failures
The env.py dev script does not return an exit code for failures, so we
add the necessary 'return' statements to do so.
2024-01-31 17:07:32 +02:00
Alex Pyrgiotis
72ddbfd55a
dev_scripts: Install a subset of Podman deps
Install a subset of Podman dependencies, so that we don't also install
Systemd. Doing so can introduce some subtle issues of its own, which is
why we prefer cherry-picking the Podman packages we really need.

Fixes #689
2024-01-30 14:24:45 +02:00
Alex Pyrgiotis
12eda5d73c
dev_scripts: Add missing git dependency
Add missing git dependency, which is required to run the `isort` command
on the development environment.
2023-12-21 21:38:39 +02:00
Alex Pyrgiotis
a2dafdb505
Add ubuntu 23.10 (mantic) support
Fixes #601
2023-10-17 11:31:30 +03:00
Alex Pyrgiotis
01d63e4eda
install: Build Dangerzone RPMs using our SPEC file
Replace the deprecated `bdist_rpm` method of creating RPMs for
Dangerzone. Instead, update our `install/linux/build-rpm.py` script, to
build Dangerzone RPMs using our SPEC file under
`install/linux/dangerzone.spec`. The script now essentially creates a
source distribution (sdist) using `poetry build`, and then uses
`rpmbuild` to create binary and source RPMs.

Fixes #298
2023-09-20 16:48:53 +03:00
Alex Pyrgiotis
f5abe0abd0
Update RPM dependencies
Update the dependencies required to build RPM packages. More
specifically, remove the older python3-setuptools dependency, and depend
instead on python3-devel and python3-poetry-core.

Note that this commit may break our CI, but it will be resolved in
subsequent commits.
2023-09-20 16:48:53 +03:00
Alex Pyrgiotis
098e532bd2
dev_scripts: Ditch sudo requirement for Docker
We don't tend to use Docker for development tasks in Linux, since we
have Podman for that. In MacOS and Windows, we do use Docker, but
typically without sudo.

Make our MacOS / Windows dev tasks non-interactive, by ditching the
`sudo` invocation.

Closes #519
2023-08-22 12:05:40 +03:00
deeplow
356f835d32
env.py: make env run in GUI mode (--no-gui otherwise)
Now that we have GUI tests, it makes more sense to have running with
the X11 socket mounted in the environment than not.
2023-08-05 17:02:26 +01:00
Alex Pyrgiotis
76a1a885f5
Force Podman use the overlay storage driver
Force Podman to use the overlay storage driver in our Dangerzone
environments. We have seen that in certain cases, Podman may opt to use
the vfs storage driver instead, which is more space-intensive.

Closes #489
2023-08-01 15:18:24 +03:00
Alex Pyrgiotis
26cf3db4b4
Install Qt6 in CI runners and dev environments
Upgrade from Qt5 to Qt6 in our CI runners and dev environments, since
the latest PySide6 versions do not support Qt5. This leaves only our
Debian / Fedora packages relying on Qt5, since there's no PySide6
package for them yet.

There are some caveats to the Qt6 upgrade:

1. Debian Bullseye has a missing dependency to `libgl1`, so we need to
   install it separately.
2. Ubuntu Jammy has a missing dependency to `libxkbcommon-x11-0`, which
   we have to install separately.
3. Ubuntu Focal does not have Qt6, but surprisingly PySide6 works with
   Qt5.
4. All Debian-based distros require `libxcb-cursor0`.

As a side effect, we have to make our `env.py` a bit more complicated,
to cater to these exceptions.

Refs #482
2023-07-25 14:53:17 +03:00
Alex Pyrgiotis
17ecde3173
dev_scripts: Fix wrong usage of Dockerfile snippet
When building the *end-user* environment for Ubuntu Lunar using
`./dev_scripts/env.py ... build`, we erroneously used a Dockerfile
snippet that is actually reserved for the *development* environment.

This pairing worked by chance, but we should use the proper Dockerfile
snippet, so that we don't mix these two environments.
2023-07-25 14:52:49 +03:00
deeplow
e989069712
Add ubuntu 23.04 (lunar) support
The Ubuntu 23.04 docker image includes a user by default (ubuntu) which
overtakes the 1000 uid and so our user becomes 1001 which makes the user
directory unwritable. The solution as suggested in [1] was to remove
that user.

[1]: https://bugs.launchpad.net/cloud-images/+bug/2005129

Fixes #452
2023-06-28 11:07:59 +01:00
Alex Pyrgiotis
517d3b58f8
dev_scripts: Map host user UID to container UID 1000
When we run our Dangerzone environments through dev_scripts/env.py, we
use the Podman flag `--userns keep-id`. This option maps the UID in the
host to the *same* UID in the container. This way, the container can
access mounted files from the host.

The reason this works is because the user within the container has UID
1000, and the user in the host *typically* has UID 1000 as well. This
setup can break though if the user outside the host has a different UID.
For instance, the UID of the GitHub actions user that runs our CI
command is 1001.

To fix this, we need to always map the host user UID (whatever that is)
to container UID 1000. We can achieve this with the following mapping:

  1000:0:1         # Map container UID 1000 to subordinate UID 0
                   # (sub UID 0 = owner of the user ns = host user UID)
  0:1:1000         # Map container UIDs 0-999 to subordinate UIDs 1-1000
  1001:1001:64536  # Map container UIDs 1001-65535 to subordinate UIDs 1001-65535

Refs #228
2023-05-25 07:55:19 +03:00
Alex Pyrgiotis
91f8f8b387
ci: Install recommended Podman packages
In Debian-based images, there are some Podman dependencies that are
marked as recommended, but are essential for rootless containers. These
dependencies will not be installed in our Dangerzone environments, due
to the `--no-install-recommends` flag.

Our approach was to find these dependencies through trial and error,
and hardcode them in our image. Turns out though that there are some
dependencies (e.g., `netavark`) that may be necessary in some Debian
flavors, and not others.

In order to not impact the readability of the env.py file, we prefer
installing Podman with all of its recommended packages. On one hand,
this will make the image size of our Debian-based Dangerzone
environments slightly larger, but on the other hand, it will make CI
tests less flaky.
2023-05-25 07:51:02 +03:00
Alex Pyrgiotis
6c7c0b615f
dev_scripts: Add missing packages in Dangerzone envs
Install the following packages in Dangerzone envs:

* python3-setuptools: We've seen that this package is necessary to build
  the RPM package for Dangerzone. The error that we encountered was the
  following:

      * Deleting old build and dist
      * Building RPM package
      Traceback (most recent call last):
        File "/home/user/dangerzone/setup.py", line 5, in <module>
          import setuptools
      ModuleNotFoundError: No module named 'setuptools'
      Traceback (most recent call last):
        File "/home/user/./dangerzone/install/linux/build-rpm.py", line 43, in <module>
          main()
        File "/home/user/./dangerzone/install/linux/build-rpm.py", line 30, in main
          subprocess.run(
        File "/usr/lib64/python3.11/subprocess.py", line 571, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command 'python3 setup.py bdist_rpm --requires='podman,python3-pyside2,python3-appdirs,python3-click,python3-pyxdg,python3-colorama'' returned non-zero exit status 1.

* fuse-overlayfs: In Ubuntu 22.10 (at least), we encountered the
  following error when running Podman:

      ERRO[0000] User-selected graph driver "overlay" overwritten by
      graph driver "vfs" from database - delete libpod local files to
      resolve

  The `vfs` driver is much slower than the `overlayfs` storage driver,
  so we need to fix this. The reason why we encounter this error is
  explained in the Podman docs [1]:

      [...] and is vfs for non-root users when fuse-overlayfs is not
      available.

  Normally, the `fuse-overlayfs` package would have been installed, but
  we don't install it due to the `--no-install-recommends` flag, so we
  install it manually.

[1]: https://docs.podman.io/en/latest/markdown/podman.1.html#storage-driver-value
2023-04-03 18:58:56 +03:00
Alex Pyrgiotis
b32f215c7c
dev_scripts: Handle alt name for Ubuntu Focal 2023-03-08 17:36:42 +02:00
Alex Pyrgiotis
aaecfdb63e
dev_scripts: Immitate mkdir -p when creating state dirs
The first time we run the env.py script, we may not have the necessary
dirs under envs. It's best to create them with `parents=True`.
2023-03-08 17:36:42 +02:00
Alex Pyrgiotis
7310977343
dev_scripts: Install Poetry via pipx
We can no longer install Poetry via `pip`, since Debian Bookworm now
enforces PEP 668, meaning that both `pip install poetry` and `pip
install --user poetry` cannot work [1]. Since we use the same
installation steps for all of our dev environments, we need to find a
common way to install Poetry.

Poetry's website provides several ways to install Poetry [2]. Moreover,
it also has a special section with CI recommendations [3]. In this
section, it strongly suggests to install Poetry via `pipx`, instead of
the installer script that you download from the Internet.

Follow Poetry's suggestion to install it via `pipx` in CI environments,
with one minor change. Do not use `pipx ensurepath`, as that will
affect the `.bashrc` of the dev environment, which at some point in the
future may be mounted by the dev. Instead, set a PATH environment
variable that includes `~/.local/bin`.

[1]: https://github.com/freedomofpress/dangerzone/issues/351
[2]: https://python-poetry.org/docs/#installation
[3]: https://python-poetry.org/docs/#ci-recommendations

Fixes #351
2023-03-08 17:36:42 +02:00
Alex Pyrgiotis
ce86c1b126
dev_scripts: Enable building envs on Ubuntu Focal
Enable installing Podman in Ubuntu Focal, by re-using the instructions
we have in our installation section. This enables us building a dev
environment for Ubuntu Focal, which we couldn't previously.
2023-02-21 20:20:04 +02:00
Alex Pyrgiotis
5100e15213
Add missing build dependencies for Ubuntu Focal
Add some missing build dependencies that we encountered for Ubuntu
Focal, but they apply to the rest of the Debian-based distros as well.
2023-02-21 20:20:03 +02:00
Alex Pyrgiotis
081c68c27f
dev_scripts: Alter the shadow-utils fix
Instead of reinstalling shadow-utils, use the actual fix that the Fedora
devs have suggested (rpm --restore shadow-utils). The previous method
does not seem to work on Fedora 37, and it threw the following error
when building the development environment:

    Installed package shadow-utils-2:4.12.3-3.fc37.x86_64 (from koji-override-0) not available.
    Error: No packages marked for reinstall.
    Error: building at STEP "RUN dnf reinstall -y shadow-utils && dnf clean all": while running runtime: exit status 1
2023-02-07 18:52:08 +02:00
Alex Pyrgiotis
ea99b1e1dd
Narrow down installed system packages
Narrow down the system packages that we install in dev environments. The
rationale is that we get most of the Python dependencies from Poetry, so
we don't need to install them from the system as well.

The packages that we do need to install are non-Python ones, and this
commit adds some that were missing: make, python3-stdeb. Also, we
explicitly install the base Qt5 libraries, in order to get the graphics
and C++ libraries that we can't get from PyPI.
2023-01-16 18:48:09 +02:00
Alex Pyrgiotis
b51691416f
dev_scripts: Introduce script for Dangerzone envs
Introduce `dev_scripts/env.py`, which is a script for building
Dangerzone environments for various Linux distros, and running commands
in them.

Closes #286
2023-01-16 18:48:09 +02:00