Tensegritics / Tensegritics/ClojureDart

docker recipe to get up and running example debian bullseye

Open
#111 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
1.6k
Forks
119
PR merge metrics
No merged PRs in 30d

Description

This is a somewhat reproducible way to get ClojureDart up and running.
Not sure whether it should find its way in the wiki or not.
It's said that even android emulator works with --priviledged.
But it might impose security risks. I haven't checked without yet.
Mind #110

also follow main README https://github.com/Tensegritics/ClojureDart/ and
it's getting started with flutter guide.

# The usb DISPLAY option cannot be changed later easily to my knowledge
docker run -ti --name bullseye_clojuredart2 --privileged -v /dev/bus/usb:/dev/bus/usb  -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp/.XIM-unix:/tmp/.XIM-unix  debian:bullseye

# following https://docs.flutter.dev/get-started/install/linux
apt-get update
# apt-install snapd -> failure cannot communicate
# migth be possible dropping security ..

apt-get sudo install curl xz-utils git unzip rlwrap openjdk-11-jdk -y

mkdir -p ~/Downloads


( # install google chrome, apt version too old
  cd ~/Downloads
  curl -O 'https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb'
  dpkg -i googl*.deb
  apt -y --fix-broken install
)

( # install clojure, apt version too old doesn't ship clj
  # trying to get clojure
  # .sh script from homepage works and provides clj, apt-get install doesn't
  # https://clojure.org/guides/install_clojure
  cd ~/Downloads
  curl -O https://download.clojure.org/install/linux-install-1.11.1.1124.sh
  chmod +x linux-install-1.11.1.1124.sh
  ./linux-install-1.11.1.1124.sh
  # clj should be working
  clj --help
)

# switching user cause chromium only runs as root with --no-sandbox as root
# no teven trying to make the web flutter backend use it
useradd -m user
sudo -u user bash
cd
mkdir -p ~/development ~/Downloads

# setting up PATH
PATH=~/development/flutter/bin:~/development/android/bin:$PATH
export CHROME_EXECUTABLE=$(which chromium)
export DISPLAY=:0

( # install flutter
  cd ~/Downloads; curl -O 'https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.0.2-stable.tar.xz';
  cd ~/development; tar xJf ~/Downloads/flutt*
  flutter doctor
)

( # optionally install android studio
  # get from here https://developer.android.com/studio?hl=de&gclid=CjwKCAjw46CVBhB1EiwAgy6M4ma8T8g2aD-HDrJKzK7lS4subnkXlanJFOtoS4qgvZk2NOUKGT14ORoC0wwQAvD_BwE&gclsrc=aw.ds
  curl 'https://r1---sn-4g5lznes.gvt1.com/edgedl/android/studio/ide-zips/2021.2.1.15/android-studio-2021.2.1.15-linux.tar.gz?cms_redirect=yes&mh=BA&mip=5.83.191.121&mm=28&mn=sn-4g5lznes&ms=nvh&mt=1655122101&mv=m&mvi=1&pl=21&rmhost=r2---sn-4g5lznes.gvt1.com&shardbypass=sd&smhost=r5---sn-4g5lzned.gvt1.com' >  ~/Downloads/android-studio-2021.2.1.15-linux.tar.gz
  cd ~/development
  tar  xzf ~/Downloads/android-studio-*-linux.tar.gz
  # run studio.sh to open UI and get basic Android SDK
  # then flutter doctor detects it
)

# eventually switch flutter version ?
flutter channel beta
flutter -version # should be working

cd ~/development
git clone --depth=1 ~/development/ClojureDart

cd ~/development/ClojureDart/samples/counter

clj -M -m cljd.build init --dart sample.counter

# from https://stackoverflow.com/questions/72301239/clojuredart-error-while-host-compiling-ns-samples-tables-require-packagef
cat >> pubspec.yaml << EOF
dependencies:
flutter:
  sdk: flutter
EOF
flutter pub get

clj -M -m cljd.build flutter -d chrome --release

# now with non release web backend doesn't seem to work running on a
# different host using DISPLAY from outer system
# So more testing is required.
# targeting Android on my phone worked.
# eg flutter devices should list your phone.
# if you're lucky its up and running

# If lib/main.dart is missnig (why ?)
# No idea why this file suddenly was gone ??
[ -f lib/main.dart ] || {
cat > lib/main.dart << EOF
export "cljd-out/sample/counter.dart" show main;
EOF
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the proposed Docker recipe with the main README and its Flutter getting-started guide. Review the commands around the samples/counter example, lib/main.dart, and the use of --privileged, then determine whether the validated setup belongs in the wiki or README. Done means a reproducible, documented setup path with its security caveats and a confirmed sample run.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, clojure, debian, docker, flutter
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.