foss42 / apidash

API Dash is a beautiful open-source cross-platform API Client built using Flutter which can help you easily create & customize your API requests, visually inspect responses and generate API integration code. A lightweight alternative to postman/insomnia.
https://apidash.dev
Apache License 2.0
1.46k stars 274 forks source link

Add support for more Linux distributions & packaging formats #213

Closed lamergameryt closed 6 months ago

lamergameryt commented 6 months ago

In the present state, the project is available as a package catering mainly to Arch Linux (pkgbuild), Debian (deb), and Red Hat (rpm) distributions. Furthermore, as evident from the blog post by @ashitaprasad at Medium, the packaging and distribution process is manual and cumbersome.

To solve this issue, there are a few steps we can take:

lamergameryt commented 6 months ago

@animator @ashitaprasad: Can you please add the Enhancement tag to this issue?

animator commented 6 months ago

@lamergameryt Instead of setting up a CI/CD pipeline right away, we want to first have clarity regarding the build process as you have read in the medium articles. So a good start will be to document the step by step build process for each distribution in this thread.

lamergameryt commented 6 months ago

@animator Sounds good; I'll document the build process for each of the above distributions as a separate comment in this issue. Starting with the step-by-step build process of a deb & rpm file, I'm using Pop!_OS 22.04 LTS x86_64 for building and testing the distributions.

Building a DEB Package

Enter the download link for the actual png file here.

wget -O ./linux/assets/apidash.png https://example.org/image.png

cat > ./linux/packaging/deb/make_config.yaml << EOF display_name: API Dash icon: linux/assets/apidash.png package_name: apidash summary: A beautiful, lightweight, open-source cross-platform API Client group: Applications/Development Tools vendor: Ashita Prasad packager: Ashita Prasad packagerEmail: ashita@xyz.com license: ASL 2.0 url: https://github.com/foss42/apidash

maintainer: name: Ashita Prasad email: ashita@xyz.com

priority: optional section: x11 dependencies:

essential: false postuninstall_scripts:

keywords:

generic_name: API Client categories:

startup_notify: true EOF

- Build the DEB package using flutter_distrubution: `flutter_distributor release --name=dev --jobs=release-dev-linux-deb`

#### Building a RPM Package

Similarly, for building a RPM distributable file:
- Create the make_config.yaml for RPM releases:
```bash
mkdir -p ./linux/packaging/rpm
mkdir -p ./linux/assets

# Enter the download link for the actual png file here.
wget -O ./linux/assets/apidash.png https://example.org/image.png

cat > ./linux/packaging/rpm/make_config.yaml << EOF
display_name: API Dash
icon: linux/assets/apidash.png
summary: A beautiful, lightweight, open-source cross-platform API Client
group: Applications/Development Tools
vendor: Ashita Prasad
packager: Ashita Prasad
packagerEmail: ashita@xyz.com
license: ASL 2.0
url: https://github.com/foss42/apidash

maintainer:
  name: Ashita Prasad
  email: ashita@xyz.com

priority: optional
section: x11
dependencies:
  - mpv

essential: false
postuninstall_scripts:
  - echo "Sorry to see you go."

keywords:
  - API
  - API Client

generic_name: API Client
categories:
  - Development
  - Utility

startup_notify: true
EOF

The above configuration works perfectly for creating DEB files. However, I'm encountering issues creating RPM files on my host machine.

warning: absolute symlink: /usr/bin/apidash -> /usr/share/apidash/apidash
I/O error : Permission denied
I/O error : Permission denied
Failed to write XML file; For permission problems, try rerunning as root

Despite this, the RPM file is successfully built and verified as OK with rpm -K apidash-0.3.0+3-linux.rpm. I tried rerunning as root, but I have to reinstall flutter_distributor as root. Hence, I'm still determining what needs to be done here. I am looking for your suggestions, @animator and @ashitaprasad.

lamergameryt commented 6 months ago
  • Package the application as an AppImage to make the application portable across distributions.

I've added implementing this application as an AppImage package to the scope of this issue to make the application portable and run everywhere.

Tanish2002 commented 6 months ago

@animator @ashitaprasad One easy way to distribute for linux is to just provide a tarball of the bundle generated by flutter build.

You can create this tarball using:

  1. flutter build linux --release (add the --target-platform flag as needed)
  2. cd into ./build/linux/x64/release/bundle
  3. create tarball for the files inside this directory using: tar -czvf apidash_x64-linux.tar.gz * (Here x64 can be replaced with the corresponding target platform.)

This tarball will contain the binary, the assests, and the linked libs. Which a packager can easily use to package the app.

Extra Notes:

I can provide some examples of repos distributing their project through tarballs.

ashitaprasad commented 6 months ago

@lamergameryt Why are you summarising the article for .deb and .rpm? That is sorted out and well documented by our team. What @animator said is to document the steps for build process for Linux platforms other than the ones we already have (.deb & .rpm).

ashitaprasad commented 6 months ago

@Tanish2002 When you are creating .deb & .rpm you can specify external dependencies. How can you do the same for the tarball?

Tanish2002 commented 6 months ago

@Tanish2002 When you are creating .deb & .rpm you can specify external dependencies. How can you do the same for the tarball?

@ashitaprasad

Dependencies in Apidash

Tarball Purpose:

Tarball as a Tool for Package Maintainers:

Caveats with Pre-built Binaries:

Ending Notes

animator commented 6 months ago
  • External dependencies: Currently, Apidash doesn't rely on external dependencies from what I've seen. Even if it does in the future, Tarballs are not supposed to be a package, (refer to the section below).

Note: API Dash currently has mpv as external dependency.

Tanish2002 commented 6 months ago

Didn't know that. What library depends on mpv?

animator commented 6 months ago

Didn't know that. What library depends on mpv?

just_audio_mpv

animator commented 6 months ago

We are converting this issue into a discussion.