mvniekerk / pgmodeler-x11

Primarily it is a way to build and run pgModeler inside Docker. However, it is also a build environment that does cross-platform UI compilation from inside Docker, compiling using GTK and Rust. i.e. it is a mechanism to build Linux and macOS binaries in Docker (Windows support on its way).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CircleCI FOSSA Status

pgModeler-X11 (X11 in Docker)

What's this?

Build and run the latest version of pgModeler inside a Docker container on Linux (& macOS).

This project is also an example of creating a build environment that does cross-platform UI compilation from inside Docker, compiling using GTK and Rust. i.e. it is a mechanism to build Linux and macOS binaries in Docker.

-- https://github.com/mvniekerk

Why?

  • Because building pgModeler is harder than it should be.

  • Because most distros are behind in their pgModeler version and/or don't have an easy way of getting the latest release - this gives another docker-based option to easily get a modern up-to-date pgModeler version.

  • This allows you to easily switch between different pgModeler versions without clobbering your config directory.

Change the PGMODELER_VERSION in the container to build another version to be run, add PGMODELER_VERSION as an environment variable when running the launcher image to start a different run image.

  • Because having a base Docker pgModeler image to be shared between users on all platforms helps address the security concerns raised by running binaries others have built. A company (such as a bank) can compile its own image and can audit how it was built and how it was stored - banks are funny that way!

  • Because having a reproducible way of building GTK applications for the three major desktop platforms using Docker and Rust rocks!

About pgModeler and commercial support

pgModeler provides pre-compiled binaries at a small price. While we are providing an easy way to build and run pgModeler, we will not be changing the scripts and images provided to build stable versions (only development versions) - this is so as not to erode their (paying) customer base.

We will also not be providing support.

Further, as you're essentially running pgModeler on Linux, it will look and feel like Linux. Which is nice if you're a Linux user, not so great if you're a Mac or Windows user - kindly buy the prebuilt binaries from the pgModeler project if this is a problem.

macOS Packaging

Please ensure you have read and understood the Xcode license terms before continuing.

Building for macOS should be done on Apple hardware!

The launcher compiles and links inside a container that has Macports installed. The binary is target/macos-x86_64/x86_64-apple-darwin/release/launcher. In order to be able to run this, you need to install gtk3 using either Brew or Macports. This will change in the future as we aim to make an application launcher to be put in your /Applications directory.

[TODO implement https://wiki.gnome.org/Projects/GTK/OSX/Bundling]

Prerequisites

Linux

  • Docker

macOS

  • Docker
  • XQuartz

Building the container

In the container directory, run ./build.sh.

This will create an image: pgmodeler-docker-x11/run.

This will take ~15 minutes.

Build and install the launcher

** Currently Linux Only **

In the launcher directory, run ./build.sh <platform> where platform is linux, mac.

Only Linux actually installs it now (for now). For macOs the binary is built but then needs to be run from the command line and have gtk3 installed (see "macOS Packaging").

When the Linux build finishes, it will create a .desktop entry in your /usr/share/applications/ directory, which means you can run pgModeler from your application launcher.

Run without the launcher

The launcher looks at your environment and then runs the command below and lets you know if something goes wrong.

But nothing is keeping you from doing it yourself. NOTE: this can/will clobber your config if you're not using 0.9.2-alpha1.

Linux

docker run --rm -it --user $(id -u) -e DISPLAY=unix$DISPLAY --workdir=$(pwd) --volume="/home/$USER:/home/$USER" --volume="/etc/group:/etc/group:ro" --volume="/etc/passwd:/etc/passwd:ro" --volume="/etc/shadow:/etc/shadow:ro" --volume="/etc/sudoers.d:/etc/sudoers.d:ro" -v /tmp/.X11-unix:/tmp/.X11-unix grindrodbank/pgmodeler

macOS

You need XQuartz installed, and 'Allow connections from network clients' selected in the X11 preferences.

Run the following two commands:

xhost + 127.0.0.1 
docker run --rm -it -e DISPLAY=host.docker.internal:0 --workdir=$(pwd) -v /Users/{your_user_folder}:/home/{your_user_folder} --volume="/etc/group:/etc/group:ro" --volume="/etc/passwd:/etc/passwd:ro" --volume="/etc/sudoers.d:/etc/sudoers.d:ro" -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):$(pwd) grindrodbank/pgmodeler

Note: Replace {your_user_folder} with the literal name of your home folder. Do not use the $USER variable.

License

FOSSA Status


© 2019, Grindrod Bank Limited.

About

Primarily it is a way to build and run pgModeler inside Docker. However, it is also a build environment that does cross-platform UI compilation from inside Docker, compiling using GTK and Rust. i.e. it is a mechanism to build Linux and macOS binaries in Docker (Windows support on its way).

License:MIT License


Languages

Language:Shell 49.9%Language:Rust 42.6%Language:Dockerfile 7.1%Language:QMake 0.3%