From mboxrd@z Thu Jan 1 00:00:00 1970 From: "briangpowell ." Subject: Re: Emacs+org-mode in a Docker? Date: Fri, 30 Oct 2015 19:58:02 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113ce9d8a5d35705235b3294 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsJYb-00050N-Rk for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 19:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZsJYZ-0001U6-1K for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 19:58:05 -0400 Received: from mail-oi0-x22b.google.com ([2607:f8b0:4003:c06::22b]:34393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsJYY-0001U2-Pq for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 19:58:02 -0400 Received: by oies66 with SMTP id s66so67846645oie.1 for ; Fri, 30 Oct 2015 16:58:02 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Matt Price Cc: emacs-org list , John Kitchin --001a113ce9d8a5d35705235b3294 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable * Here are some of my notes+URL links on some docker+emacs experiments thus far: ** Last I checked some glimmering developments seem to be coming to light in the docker+emacs realm: *** Believe some links below might be stepping-stones for your students, Dr. Kitchin: ** Happily, below, I note coming across some work by one of our favorite Elisp hackers of "elnode" fame: Nic Ferrier ** "docker.el" was in development too last I looked into this--see link below. * Linux Containers: ###1 read and take advice here FIRST: http://stackoverflow.com/questions/27083182/running-emacs-in-a-docker-conta= iner ** These links are slightly tangential but I suggest them since they're also stepping-stones to really what's going on under-the-docker-hood: ** https://en.wikipedia.org/wiki/Copy-on-write ** http://www.linuxjournal.com/content/docker-lightweight-linux-containers-con= sistent-development-and-deployment?page=3D0,0 ** http://www.liquidweb.com/kb/how-to-install-docker-on-ubuntu-14-04-lts ** http://aufs.sourceforge.net ** https://linuxcontainers.org * Can run xampp on a docker--see notes and experiments below, here are first checks and steps: ** docker inspect garland/xampp-base docker ** netstat -lnp|grep 8080" ; echo "=3D>" ; netstat -lnp | grep 8080 ; sleep= 3 * Now try to run the xampp container: docker run -t -i -p 8080:80 garland/xampp-base /bin/bash & * /opt/lampp/lampp startapache ** http://localhost:8080/xampp/splash.php ** xterm -e docker run -i -t debian /bin/bash ** xterm -e docker run -i -t ubuntu /bin/bash ** docker run -i -t debian /bin/bash & *** xampp on docker!?: * Enabling XAMPP Web Interface with docker: Start Docker in interactive mode [[shell:docker run -t -i -p 8080:80 garland/xampp-base /bin/bash &]] vim /opt/lampp/etc/extra/httpd-xampp.conf Remove the bottom 4 lines.docker.el **** Commented out the bottom 4 lines and then this got it semi-working (returned "Object not found!" error) after I did this: /opt/lampp/lampp startapache google-chrome http://localhost:8080/:80 ***** This worked!(after starting apache in the docker xterm): google http://localhost:8080/xampp/splash.php ** https://github.com/Silex/docker.el * [[shell:echo * Put emacs in Docker(but remember all writes will be lost--so to really keep things write to volume(s)):";cd;docker pull biscarch/emacs &]] ** Just mounted a "volume" (to Docker: volumes are read-write(usually) dirs and/or files outside the Union File system (aufs) and available to the host AND the container) docker run -it --name container-test -h CONTAINER -v /data debian /bin/bash docker inspect -f {{.Volumes}} container-test =3D> map[/data:/var/lib/docker/vfs/dir/79d22ddf7a12b6e283c74df521289adb6b5378836= 86eb43aa3c2405f0c6aacae] date > /var/lib/docker/vfs/dir/79d22ddf7a12b6e283c74df521289adb6b537883686eb43aa3c= 2405f0c6aacae/date.j root@CONTAINER:/# cat /data/date.j =3D> Mon Jul 20 09:08:33 EDT 2015 ** http://container-solutions.com/understanding-volumes-docker/ "Quite simply, volumes are directories (or files) that are outside of the default Union File System and exist as normal directories and files on the host filesystem." In order to be able to save (persist) data and share data between containers, Docker came up with the concept of volumes: Quite simply, volumes are directories (or files) that are outside of the default Union File System and exist as normal directories and files on the host filesystem. There are two ways to initialise volumes, with some subtle differences that are important to understand. We can declare a volume at run-time with the -v flag: =EF=BF=BC $ docker run -it --name container-test -h CONTAINER -v /data debian /bin/bash root@CONTAINER:/# ls /data root@CONTAINER:/# This will make the directory /data inside the container live outside the Union File System and directly accessible on the host. *** Trying this but fails--may have to do before booting the container?: docker run -v /home/b/data55:/data55 debian ls /data55 ** Can also give access to a "volume" that is available in one container to another *** Can't you use FUSE with a container!? ** "you can also mount a directory from your own host into a container:" $ sudo docker run -d -P --name web -v /src/webapp:/opt/webapp training/webapp python app.py *** The above will mount the local directory, /src/webapp, into the container as the /opt/webapp directory. This is very useful for testing; for example, we can mount our source code inside the container and see our application at work as we change the source code! **** But with UNIONFS and AUFS this functionality has been available for many years. ** To test docker install docker search debian docker pull debian docker run -i -t debian /bin/bash *** And/or docker pull ubuntu docker run -i -t ubuntu /bin/bash * Yet another emacs in a docker(which I've done successfully--see above--but this is "dmacs"): [[https://github.com/bcbcarl/docker-emacs]] docker pull bcbcarl/emacs sudo curl -L https://raw.githubusercontent.com/bcbcarl/docker-emacs/master/bin/dmacs -o /usr/local/bin/dmacs sudo chmod +x /usr/local/bin/dmacs * This didn't quite work but very interestin'--nic the elnode man Nic Ferrier at it again: https://github.com/nicferrier/emacs-in-a-docker *** This didn't work; but, here's his plan: This puts Emacs into a docker! I am sure this is going to be useful for tests and things like that. Subdirectories Since there are an immediate load of things you might do with Dockers (run a daemon, run a batch in various ways, etc...) I'll put subdirs here with usable Dockerfiles for doing those things. emacsd A docker with an Emacs daemon in it. $ sudo docker.io run -d -v $(realpath sockets):/tmp/emacs1000 nicferrier/emacsd $ emacsclient -s sockets/sock/server -e '(+ 1 1)' * Other Emacs Dockerfiles Elnode has a few Dockerfiles to allow quick deployment. So far I've based all the Emacs Dockerfiles I've built on emacsd. ** Other sites: https://github.com/nicferrier/emacs-lxc/blob/master/lxc.el https://github.com/nicferrier https://www.youtube.com/watch?v=3DeTeKDStj30Y https://www.google.com/webhp?sourceid=3Dchrome-instant&ion=3D1&espv=3D2&ie= =3DUTF-8#q=3Dnic%20ferrier%20emacs%20container http://emacswiki.org/emacs/NicFerrier https://libraries.io/github/nicferrier/emacs-lxc http://nic.ferrier.me.uk/blog/2013_08/the-emacs-tapas https://github.com/nicferrier/docker-shell-deploy/blob/master/README.md http://www.emacswiki.org/emacs/TrampAndDocker * Docker Backups If you=E2=80=99re using a data-container, it=E2=80=99s pretty trivial to do= a backup: $ docker run --rm --volumes-from dbdata -v $(pwd):/backup debian tar cvf /backup/backup.tar /var/lib/postgresql/data ** Above should create a tarball of everything in the volume (the official postgres Dockerfile defines a volume at /var/lib/postgresql/data). On Fri, Oct 30, 2015 at 3:57 PM, Matt Price wrote: > I don't have any thoughts but would love to see what you ocme upwith. > Would be great not only for teaching but e.g. for pointing to a working > environment for research results. > > On Fri, Oct 30, 2015 at 12:13 PM, John Kitchin > wrote: > >> Has anyone tried setting up a Docker with an Emacs and org-mode setup? >> >> I am looking for some kind of solution like this to use with some >> students. Any thoughts? >> >> Thanks, >> >> -- >> Professor John Kitchin >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> @johnkitchin >> http://kitchingroup.cheme.cmu.edu >> >> > --001a113ce9d8a5d35705235b3294 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
* Here are some of my notes+URL links on some docker+= emacs experiments thus far:

** Last I checked some= glimmering developments seem to be coming to light in the docker+emacs rea= lm:

*** Believe some links below might be stepping= -stones for your students, Dr. Kitchin:

** Happily= , below, I note coming across some work by one of our favorite Elisp hacker= s of "elnode" fame: Nic Ferrier=C2=A0

**= "docker.el" was in development too last I looked into this--see = link below.

* Linux Containers: ###1 read and take= advice here FIRST: http://stackoverflow.com/questions/270= 83182/running-emacs-in-a-docker-container=C2=A0

** These links are slightly tangential but I suggest them since they&= #39;re also stepping-stones to really what's going on under-the-docker-= hood:

** https://en.wikipedia.org/wiki/Copy-on-write=C2=A0
**= http://aufs.sourceforge.net

* Can run xampp on a docker--see notes and= experiments below, here are first checks and steps:
** docker in= spect garland/xampp-base docker
** netstat -lnp|grep 8080" ;= echo "=3D>" ; netstat -lnp | grep 8080 ; sleep 3=C2=A0
<= div>* Now try to run the xampp container:
docker run -t -i -p 808= 0:80 garland/xampp-base /bin/bash &

* /opt/lam= pp/lampp startapache
** xterm -e = docker run -i -t debian /bin/bash
** xterm -e docker run -i -t ub= untu /bin/bash
** docker run -i -t debian /bin/bash &
*** xampp on docker!?:=C2=A0

* Enabling XAMPP W= eb Interface with docker:

Start Docker in interact= ive mode

[[shell:docker run -t -i -p 8080:80 garla= nd/xampp-base /bin/bash &]]

vim /opt/lampp/etc= /extra/httpd-xampp.conf
Remove the bottom 4 lines.docker.el
=
**** Commented out the bottom 4 lines and then this got it semi-workin= g (returned "Object not found!" error) after I did this:
/opt/lampp/lampp startapache
google-chrome http://localhost:8080/:80=C2=A0
***** This = worked!(after starting apache in the docker xterm): google http://localhost:8080/xampp/splash.php


* [[shel= l:echo * Put emacs in Docker(but remember all writes will be lost--so to re= ally keep things write to volume(s)):";cd;docker pull biscarch/emacs &= amp;]]

** Just mounted a "volume" (to Do= cker: volumes are read-write(usually) dirs and/or files outside the Union F= ile system (aufs) and available to the host AND the container)
do= cker run -it --name container-test -h CONTAINER -v /data debian /bin/bash
docker inspect -f {{.Volumes}} container-test =3D> map[/data:/v= ar/lib/docker/vfs/dir/79d22ddf7a12b6e283c74df521289adb6b537883686eb43aa3c24= 05f0c6aacae]
date > /var/lib/docker/vfs/dir/79d22ddf7a12b6e283= c74df521289adb6b537883686eb43aa3c2405f0c6aacae/date.j
root@CONTAI= NER:/# cat /data/date.j =3D> Mon Jul 20 09:08:33 EDT 2015
** <= a href=3D"http://container-solutions.com/understanding-volumes-docker/">htt= p://container-solutions.com/understanding-volumes-docker/ "Quite s= imply, volumes are directories (or files) that are outside of the default U= nion File System and exist as normal directories and files on the host file= system."
In order to be able to save (persist) data and shar= e data between containers, Docker came up with the concept of volumes:
Quite simply, volumes are directories (or files) that are outside of = the default Union File System and exist as normal directories and files on = the host filesystem.
There are two ways to initialise volumes, wi= th some subtle differences that are important to understand. We can declare= a volume at run-time with the -v flag:
=EF=BF=BC
$ doc= ker run -it --name container-test -h CONTAINER -v /data debian /bin/bash

root@CONTAINER:/# ls /data
root@CONTAI= NER:/#=C2=A0
This will make the directory /data inside the contai= ner live outside the Union File System and directly accessible on the host.=
*** Trying this but fails--may have to do before booting the con= tainer?:
docker run -v /home/b/data55:/data55 debian ls /data55
** Can also give access to a "volume" that is available = in one container to another
*** Can't you use FUSE with a con= tainer!?
** "you can also mount a directory from your own ho= st into a container:"
$ sudo docker run -d -P --name web -v = /src/webapp:/opt/webapp training/webapp python app.py
*** The abo= ve will mount the local directory, /src/webapp, into the container as the /= opt/webapp directory. This is very useful for testing; for example,=C2=A0
we can mount our source code inside the container and see our appl= ication at work as we change the source code!
**** But with UNION= FS and AUFS this functionality has been available for many years.
** To test docker install
docker search debian
docker = pull debian
docker run -i -t debian /bin/bash
*** And/o= r
docker pull ubuntu
docker run -i -t ubuntu /bin/bash<= /div>
* Yet another emacs in a docker(which I've done successfully-= -see above--but this is "dmacs"): [[https://github.com/bcbcarl/docker-emacs]]
<= div>docker pull bcbcarl/emacs
sudo chmod +x /usr/local/bin/dmacs
* This d= idn't quite work but very interestin'--nic the elnode man Nic Ferri= er at it again: https://github.com/nicferrier/emacs-in-a-docker
*** This did= n't work; but, here's his plan:

This puts = Emacs into a docker!

I am sure this is going to be= useful for tests and things like that.

Subdirecto= ries

Since there are an immediate load of things y= ou might do with Dockers (run a daemon, run a batch in various ways, etc...= ) I'll put subdirs here with usable Dockerfiles for doing those things.=

emacsd

A docker with an = Emacs daemon in it.

$ sudo docker.io run -d -v $(realpath sockets):/tmp/emacs1000 nicferrier= /emacsd
$ emacsclient -s sockets/sock/server -e =C2=A0'(+ 1 1= )'

* Other Emacs Dockerfiles
Elnode has a few Dockerfiles to allow quick deployment. So far = I've based all the Emacs Dockerfiles I've built on emacsd.
** Other sites:
htt= ps://www.google.com/webhp?sourceid=3Dchrome-instant&ion=3D1&espv=3D= 2&ie=3DUTF-8#q=3Dnic%20ferrier%20emacs%20container
<= a href=3D"http://www.emacswiki.org/emacs/TrampAndDocker">http://www.emacswi= ki.org/emacs/TrampAndDocker

* Docker Backups

If you=E2=80=99re using a data-container, it=E2=80= =99s pretty trivial to do a backup:

$ docker run -= -rm --volumes-from dbdata -v $(pwd):/backup debian tar cvf /backup/backup.t= ar /var/lib/postgresql/data

** Above should create= a tarball of everything in the volume (the official postgres Dockerfile de= fines a volume at /var/lib/postgresql/data).

On Fri, Oct 30, 2015 at 3:57 PM, Mat= t Price <moptop99@gmail.com> wrote:
I don't have any thoughts but would love= to see what you ocme upwith.=C2=A0 Would be great not only for teaching bu= t e.g. for pointing to a working environment for research results.

On Fri, Oct 30, 2015 at 12:13 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
Has anyone tried setting up a Docker with an Emacs and org-mode s= etup?

I am looking for some kind of solution like this to use with some
students. Any thoughts?

Thanks,

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-2= 68-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



--001a113ce9d8a5d35705235b3294--