Giter Club home page Giter Club logo

dfiles's Introduction

dfiles

dfiles is primarily two things:

  • a collection of containerized desktop/GUI applications intended for Linux desktops
  • a library designed to facilitate the quick development of new containerized desktop/GUI applications by abstracting away concerns such as providing container access to host services like pulseaudio, dbus, X11

About

Running your desktop application in a container has a number of benefits:

  • Applications are isolated from one another as much as possible at the process level.
  • You get to choose what parts of your filesystem are "seen" by each application.
  • Many applications assume only you only ever want to use it in a single context (login, session state, project data, etc). With dfiles-managed applications you get the opportunity to specify differente runtime profiles using the -p/--profile flag to effectively isolate different use cases from one another.
  • Containerized applications are highly portable between not only Linux distributions, but between different computers and across reinstalls; thanks to Cargo (rust's package manager), installing dfiles-based apps is trivially easy on new computers and (on the roadmap) will eventually allow you to choose the version of the app installed.
  • Some people don't like installing proprietary libraries and applications onto their main operating system but some use case (Steam, Skype, Zoom, etc) require it; containerization lets them limit those applications' access to the rest of the system.

However, there can be some drawbacks:

  • Since each application runs in its own Linux container/namespace with its own distinct filesystem, there will be reduced memory efficiencies from the use of shared/dynamically-linked libraries.

The target audience, at least during early stages of development, are technically savvy people who don't mind a few rough edges here and there while I (and anyone who wants to contribute) work to smooth them out.

Building & Installing

dfiles currently assumes that you have a reasonably up-to-date Rust toolchain and package manager installed. The rust-lang book installation guide is the best source of information on how to get Rust up and running.

Usage

Installing dfiles apps

Build a dfiles app

Assuming you have not cargo install'd the app directly from crates.io and assuming that your cargo bin directory is at the front of your PATH:

git clone [email protected]:waynr/dfiles
cd dfiles
cargo install -p firefox
firefox build

You should see the same output as you would see building a docker image using docker build ..

TODO: Install from crates.io

Run a dfiles app

After installing an app and building its associated container image:

firefox run

This will run firefox in the "default" profile. This is not to be confused with the built-in firefox concept of profiles but relates instead to the host system directories mounted into the container at run time. To mount a different set of profile directories, which in the case of firefox results in total isolation of session data, plugins, browse history, etc:

firefox run -p a-different-profile

For firefox and other applications with a built-in notion of profiles it may not make as much sense to do this, but for other applications where there is one assumed set of profile/session data for a given user, you may get more use out of this.

Configure a dfiles app

In addition to default behaviors built into applications it is possible to configure them the application level with customizations such as volume mounts, cpu/memory limits, etc:

firefox config --mount <hostpath>:<containerpath>
firefox config --memory 1024mb

Configuration specified in this way will apply to all of the application's profiles. To limit config settings to a specific profile:

firefox config --profile --mount <hostpath>:<containerpath>

Roadmap

  • Before open source:
    • Aspect-oriented configuration schema for applications with support for profiles.
    • Implement configurable aspects:
      • CPU shares
      • Memory
      • Network mode
      • Locale
      • CurrentUser
        • Replace buildtime user setup with entrypoint script user setup.
    • Improve README.
    • Implement some kind of automated image build and push.
    • Replace all unwrap and Box<dyn Error> instances with better error handling
    • Figure out some kind of data directory approach that isolates dfiles application data directories to some kind of dfiles-specific XDG data directory. For example, don't let firefox use $HOME/.mozilla/firefox -- dfiles apps should not mess with application data managed by vanilla installs of the same app
    • Figure out container versioning schema of some kind.
    • Prune current apps of unnecessary aspects (most probably don't need SysAdmin or Shm)
  • Remove NetworkHost default behavior.
  • Consider framework for lightweight runtime container setup:
    • generate and inject entrypoint script at runtime
      • simple, easy to understand
      • but could burn through seconds every program startup
    • build user-specific image from prebuilt static base image with user-specific, config-dependent dynamic setup steps

Similar Projects

jessfraz/dockerfiles

dfiles is strongly influenced by github.com/jessfraz/dockerfiles and this blog post.

Significant differences include:

  • dfiles generates Dockerfiles dynamically based on a combination of hard-coded and user-configured "Aspects"
    • makes it easy to share code between different applications
  • dfiles hides implementation details of running containers by generating docker run command lines

snap

Snap is a distro-agnostic package manager that distributes containerized applications, similar in principle to the end result produce by dfiles but more well-fleshed out and probably more suitable if all you care about is just installing a thing and getting it running.

Significant differences include:

  • dfiles targets Docker as its container runtime and aims to (eventually) leverage the docker registry ecosystem for distribution of images
  • dfiles is more developer-oriented for people who like to build their own images

dfiles's People

Contributors

dependabot[bot] avatar morrislaw avatar waynr avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

morrislaw

dfiles's Issues

Error pulling from waynr/firefox

From ~/.cargo/bin after cargo install of firefox app. When following the instructions around ./firefox run, I get a failure to pull waynr/firefox.

jkwiatko@doubu:~/.c/bin
➤ ./firefox run
Profile - ["-v", "/home/jkwiatko/.local/share/dfiles/applications/firefox/profiles/default/home/jkwiatko/.mozilla/firefox/profile:/home/jkwiatko/.mozilla/firefox/profile"]
Debian - []
firefox - []
Name - ["--name", "default"]
User: jkwiatko - []
PulseAudio - ["-v", "/home/jkwiatko/.pulse:/home/jkwiatko/.pulse", "-v", "/home/jkwiatko/.config/pulse:/home/jkwiatko/.config/pulse", "-v", "/run/user/1000/pulse:/run/user/1000/pulse"]
X11 - ["-e", "DISPLAY=unix:0", "-v", "/tmp/.X11-unix:/tmp/.X11-unix", "--device", "/dev/dri"]
Video - ["--device", "/dev/video1", "--device", "/dev/video0"]
DBus - ["-v", "/run/user/1000/bus:/run/user/1000/bus", "-v", "/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket", "-v", "/home/jkwiatko/.dbus/session-bus:/home/jkwiatko/.dbus/session-bus", "-e", "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"]
Shm - ["-v", "/dev/shm:/dev/shm"]
docker run --rm -v /home/jkwiatko/.local/share/dfiles/applications/firefox/profiles/default/home/jkwiatko/.mozilla/firefox/profile:/home/jkwiatko/.mozilla/firefox/profile --name firefox-default -v /home/jkwiatko/.pulse:/home/jkwiatko/.pulse -v /home/jkwiatko/.config/pulse:/home/jkwiatko/.config/pulse -v /run/user/1000/pulse:/run/user/1000/pulse -e DISPLAY=unix:0 -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/dri --device /dev/video1 --device /dev/video0 -v /run/user/1000/bus:/run/user/1000/bus -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket -v /home/jkwiatko/.dbus/session-bus:/home/jkwiatko/.dbus/session-bus -e DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus -v /dev/shm:/dev/shm waynr/firefox:0.1.0 /opt/firefox/firefox-bin --no-remote --profile /home/jkwiatko/.mozilla/firefox/profile
Unable to find image 'waynr/firefox:0.1.0' locally
docker: Error response from daemon: pull access denied for waynr/firefox, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

Is there a more public image that I should be using? Or should I be pointing to my own image?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.