• Stars
    star
    170
  • Rank 223,357 (Top 5 %)
  • Language
    Lua
  • License
    MIT License
  • Created almost 2 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Best Web Development Environment in a (Distro)Box
                  ___.        .___          ___.                 
    __  _  __ ____\_ |__    __| _/_______  _\_ |__   _______  ___
    \ \/ \/ // __ \| __ \  / __ |/ __ \  \/ /| __ \ /  _ \  \/  /
     \     /\  ___/| \_\ \/ /_/ \  ___/\   / | \_\ (  <_> >    < 
      \/\_/  \___  >___  /\____ |\___  >\_/  |___  /\____/__/\_ \
                 \/    \/      \/    \/          \/            \/
61 6B 69 74 61 6F 6E 72 61 69 6C 73 40 43 6F 64 65 4D 69 6E 65 72 34 32 

WebDevBox DemoTEXT

Distrobox WebDevBox

This is an Archlinux based Docker image that comes pre-installed with everything I think a web developer would need in the 2020s. Every language, every tool, every helper.

Take a look at the Dockerfile to see all packages, but in summary:

  • ZSH (of course) with several plugins
  • Chezmoi to sync your dotfiles
  • LunarVim already configured to work with TMUX
  • All major languages (Ruby, Nodejs, Python, PHP, Kotlin, etc)
  • ASDF so you can install specific old language versions for your projects
  • Podman by default, and every Devops tool (K8S, Skaffold, Helm, Terraform, etc)
  • All the normal debug tools (lsof, strace, etc)

Usage

First, install Podman in your OS (Docker works fine as well), for example, in Arch:

$ sudo pacman -S podman

Install Distrobox. I tried the "distrobox-git" package in AUR, but Distrobox is still in heavy development and I stumbled upon a old bug that was already solved in the main branch, so I recommend installing the "unstable" version manually:

$ curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh -s -- --next

Now you have 2 options. The easy one is to just pull the image from DockerHub:

$ podman pull docker.io/akitaonrails/webdevbox:latest

Or you can customize the Dockerfile and build it manually:

$ git clone https://github.com/akitaonrails/webdevbox.git
$ cd webdevbox
$ podman build . -t akitaonrails/webdevbox

Finally, it's normal Distrobox usage. Let's create the box and enter in it:

$ mkdir -p ~/.local/share/distrobox/webdevbox

$ distrobox create \
  -i akitaonrails/webdevbox \
  -n webdevbox-demo -I \

$ distrobox enter webdevbox-demo

WARNING: Distrobox maps its internal home directory directly on top of your real home by default. It will automatically create a user with the same username as you are using right now, so it should be very seamleass to transition between them. But be careful that whatever destructive command you run over your home files, will be permanent. If you prefer not to expose your home directory directly, you can point the internal home to somewhere else, like this:

$ distrobox create \
  -i akitaonrails/webdevbox \
  -n webdevbox-demo -I \
  -H ~/.local/share/distrobox/webdevbox \
  --volume $HOME:/mnt/host

I prefer to map to a new directory and have a separated home per box. Then map my home as an external drive in "/mnt/host".

Then we can initialize Chezmoi. I'd recommend first forking my dotfiles repository, but let's use it as example:

$ chezmoi init https://github.com/akitaonrails/dotfiles
$ chezmoi update

It will prompt you for your specific information such as preferred Git email. I configured Tmux to have the key bind "Ctrl+Alt+n" to open a new pane directly to a text file to serve as a shortcut for times when you want to make quick notes or add reminders. I usually point to my Dropbox synced Obsidian directory, for example.

And if you want to run Podman inside Distrobox (yes! you can run a new container inside another container, Podman is already configured to run rootless inside), and if you chose to map your home directory directly to your real home, then make sure to create the volume for the containers:

$ mkdir -p $HOME/.local/share/containers/storage/

Whenever you podman pull inside the Box, the blobs will be stored there, so not to bloat the box itself. Remember that changes made inside the box are persistent.

And that's it. You can start working!

FAQ

Did you configure Git Aliases?

Yes, type git la to have a list of all the built-in aliases

How can I see Tmux shortcuts?

Type "Ctrl+b" and "?" to open a short (incomplete) list. But reading the ".tmux.conf" file is easier.

How do I navigate in Tmux?

The navigation key binding were customized. The same Ctrl+[hjkl] are used to navigate between both Tmux panels and LunarVim panels.

I also configured navigaton in copy mode to be like Vim (hjkl). Get used to the Vi style of using "hjkl" instead of arrow keys.

Do read .tmux.conf from my dotfiles repo.

Did you customize LunarVim?

LunarVim is mostly stock. I did add a few plugins such as GitHub CoPilot and ChatGPT.

Do read config.lua, and go to the bottom of the file to see what I changed.

Why didn't you install virtualenv, nvm or rvm?

Because the box comes with the much superior ASDF.

Why did you install the pacman language packages if you installed ASDF?

The best practice is to have the native packages in the OS do their job. Only configure custom language versions from asdf per project. For example:

$ cd my_project
$ asdf install ruby 2.6.0
$ asdf local ruby 2.6.0

Now only this project directory responds to the specific obsolete Ruby 2.6.

Why Chezmoi to manage dotfiles?

Because it felt simple. You should always edit dotfiles in the ~/.local/share/chezmoi directory and add information specific to your machine in ~/.config/chezmoi/chezmoi.toml.

If you created a new dotfile, add it to the repository:

$ chezmoi add --autotemplate .fishrc

If you changed some file in the local/share directory, update your real files with:

$ chezmoi update

When everything is working, push to your fork of my dotfiles with:

$ chezmoi cd
$ git add . ; git commit -m "description" ; git push origin main
$ exit

Read their documentation

What are the largest installed packages?

This is why I chose not to install Postman (~300MB), Azure-Cli (~600MB), Google Cloud SDK (600MB). You can install them inside the box anyway. But damn, Rust is heavy!

❯ yay -Ps
==> Yay version v11.3.2
===========================================
==> Total installed packages: 558
==> Foreign installed packages: 10
==> Explicitly installed packages: 83
==> Total Size occupied by packages: 4.8 GiB
==> Size of pacman cache /var/cache/pacman/pkg/: 30.0 MiB
==> Size of yay cache /home/akitaonrails/.local/share/distrobox/webdevbox/.cache/yay: 0.0 B
===========================================
==> Ten biggest packages:
rust: 526.4 MiB
insomnia-bin: 394.9 MiB
jdk11-openjdk: 322.2 MiB
chromium: 277.2 MiB
go: 195.6 MiB
gcc: 171.3 MiB
jre11-openjdk-headless: 159.8 MiB
gcc-libs: 137.8 MiB
llvm-libs: 120.5 MiB
erlang-nox: 105.8 MiB
===========================================

I'm receiving errors from Podman or Podman Compose

If you see errors similar to this:

ERRO[0000] running /usr/sbin/newuidmap 25137 0 1000 1 1 75537 65535: newuidmap: write to uid_map failed: Operation not permitted

Then run this in the terminal:

$ __webdevbox_podman_config

The initial welcome script already runs this, but for some reason the error comes back until we run this again.

Happy Hacking!

Copyright (C) Fabio Akita - 2023 MIT LICENSED

More Repositories

1

akitando_episode_0118

examples to illustrate my YouTube channel's episode 118 about Databases
JavaScript
240
star
2

computer_languages_genealogy_graphs

Graphviz/Dot files generator for computer languages genealogy
Ruby
194
star
3

rinhabackend-rails-api

Ruby
160
star
4

chainable_methods

The most complete implementation of an Elixir/F#-like "Pipe" for Ruby in the form of "chainable methods"
Ruby
151
star
5

plex-docker-compose

docker compose to run the containers in my local plex server
117
star
6

plex_home_server_docker

Docker Compose scripts for a Plex Media Server with pull capabilities with Sonarr, Radarr, etc.
91
star
7

manga-downloadr

download mangas from MangaReader.net and compile Kindle optimised PDFs
Ruby
89
star
8

cramp_chat_demo

Bare bone chat demo using @lifo's Cramp
JavaScript
82
star
9

ex_manga_downloadr

Port of the Ruby version of Manga Downloadr to fetch mangas from MangaReader.net
Elixir
73
star
10

dynamic_liquid_templates

Manage your templates in your database instead of view files, and with Liquid templating support.
JavaScript
60
star
11

rinhabackend-lucky-crystal-api

Crystal
50
star
12

dotfiles

Chezmoi managed dotfiles
Lua
37
star
13

ObjC_Rubyfication

Attempt to make Objective-C more like Ruby
C
35
star
14

third_rails

A fresh Rails 3.0 app with generators, Rack::Bug with Orchestra and Thorfile examples.
Ruby
33
star
15

rubyconf2011

Site da RubyConf Brasil 2011
Ruby
31
star
16

ASP_Classic_WebForm

A very old (2001) experiment on implement a ASP.NET Web Forms-like framework in ASP Classic
ASP
28
star
17

slack_cleanup

Elixir based command line tool to delete all files from your Slack account
Elixir
25
star
18

locarails

Configuracao de Capistrano automatica para hospedagens Linux Locaweb
Ruby
25
star
19

lw-pagto-certo

Gem que se comunica com o serviço "Pagamento Certo" da Locaweb
Ruby
23
star
20

fiberpool

Simulate a queue and a pool of job workers, in essence a "Fiber Pool" for Crystal
Crystal
23
star
21

episode0139

Example files described in the Episode 139, about Containers
JavaScript
18
star
22

cr_manga_downloadr

Second version of the Ruby version of my MangaReader.net crawler adapted for Crystal
Crystal
17
star
23

ryanb-15min-blog

Ryan Bates' new 15 min blog demo available at the official Ruby on Rails website
Ruby
15
star
24

elo_demo

small demonstration of how using Elo rating makes a lot of difference in rankings
Ruby
14
star
25

gamegenie

simple exercise to decode Game Genie codes into the proper addresses and values
Crystal
13
star
26

rinhabackend-python-fastapi

Python
13
star
27

ex_messenger_exercise

Original from Drew Kerrigan
Elixir
13
star
28

mygist

Ruby Gem to interface with Gist + command line to use it interactively
Ruby
12
star
29

vagrant-railsbox

Rails development environment for Vagrant + Berkshelf
Ruby
11
star
30

i3-dotfiles

Arch + i3 + nvim
Vim Script
10
star
31

static_site_demo

Example Rails 4.2 app implementing a fast static site that rivals pure static generators
Ruby
10
star
32

rolling_with_rails_tutorial

Support material for the Rolling with Rails Tutorial
Ruby
9
star
33

rinhabackend-nim-jester-api

Nim
9
star
34

image_uploader_demo

Simple Demonstration of how to add S3 Direct Upload with Carrierwave Backgrounder
Ruby
9
star
35

answers_demo

answers.37signals.com clone
Ruby
9
star
36

qmk_firmware

fork for my own keymaps
C
9
star
37

typeractive-corne-zmk-config

9
star
38

code42coin-exercise

Leartning from: https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6
JavaScript
8
star
39

cr_chainable_methods

Attempt at a (limited) Pipe Operator for Crystal
Crystal
8
star
40

ASP-Classic-XML-NoSQL

This is an example of how I made AJAX and NoSQL before the terms were even created
ASP
7
star
41

ex_pusher_lite

Implementation of a Phoenix Channel based core for a Pusher replacement
Elixir
6
star
42

jruby_calculator_demo

JRuby Swing Calculator demonstration
Java
6
star
43

elixir-koans-results

Elixir
6
star
44

cr_subtitle_shift

Port of my Shift-Subtitle Ruby script to Crystal
Crystal
6
star
45

udev-usb-controller

Scripts to enable hotplugging usb joysticks into a running Virsh VM
Shell
5
star
46

depot

Sample application from "Agile Web Development with Rails."
Ruby
5
star
47

Shift-Subtitle

One example of solution for the Rubylearning Challenge #1
Ruby
5
star
48

rust_ruby_exercise_1

Simple Rust exercise to parse a file and be consumed through Ruby/FFI
Rust
5
star
49

reveal.js-for-developers

Customization over vanilla Reveal.js to make it suitable for Software Developers
JavaScript
5
star
50

RailsConf-2010---Restfulie

Basic demonstration for the RailsConf 2010 talk about RESTful and Restfulie
Ruby
5
star
51

CoffeeScript-Demonstration

Small demonstration of coffeescript with jQuery UI in a Rails app
Ruby
5
star
52

TinyClone

Rails 3 version of the original Sinatra-based TinyClone
Ruby
5
star
53

wiki_exercicio

Pequeno exercício de Ruby on Rails - não é uma aplicação completa
Ruby
4
star
54

pusher_lite_demo

Basic Rails app to showcase the difference between using Pusher and a Phoenix-based replacement
Ruby
4
star
55

learn_to_program_pt_br

the original source for http://aprendaaprogramar.rubyonrails.pro.br/
Ruby
4
star
56

twitter_dumper

Ruby
4
star
57

screencast_demo

Projeto de demonstração para o Screencast do Git
Ruby
4
star
58

locosxrails_i18n_demo

Demonstration I18n App for Locos x Rails conference
Ruby
3
star
59

gem_exemplo

Gem de exemplo.
3
star
60

demo_responds_to_parent

Exercise With Responds To Parent
JavaScript
3
star
61

ObjC_XmlBuilder

Experimental clone of Ruby's Builder::XmlMarkup
Objective-C
3
star
62

restfulie-full-examples

Full examples on how to use restfulie
Ruby
3
star
63

enki-translator

Importers for enki from other blog engines
3
star
64

ObjC_OnigurumaDemo

Small app to demonstrate integration with ObjC_Rubyfication, particularly using Oniguruma
C
3
star
65

cr_slack_cleanup

Crystal version for my Elixir-based Slack clean up tool
Crystal
2
star
66

pxblog_phoenix_exercise

Elixir
2
star
67

fisl_10_demo

Demonstração da minha palestra no FISL 10 de 2009
Ruby
2
star
68

jruby_windows_demo

Small demonstration of configuring a Rails app for JRuby to run on Windows connecting to a SQL Server DB
Ruby
1
star
69

revealjs-feevale-2017

Palestra para o meetup na Feevale/RS 2017
JavaScript
1
star
70

pxblog_rails_exercise

Ruby
1
star