apg
2017-10-27 17:08:06

Where the reader is the user, and in some cases the text -> racket object reader.


lexi.lambda
2017-10-27 17:44:42

@mflatt For the purposes of maintaining two separate namespaces, would there be anything dangerous about making each namespace’s scope a global, well-known scope, rather than a separate scope per module? I’m trying to think about if there are corner cases that would break hygiene, but I don’t think so, since the existing per-module scope will prevent bindings across modules from interacting in undesirable ways.


drdeeglaze
2017-10-27 18:23:39

@lexi.lambda would that not entail needing a scope that purports to be distinct from other scopes and the same across builds?


lexi.lambda
2017-10-27 18:24:27

It would, but that can be done with the make-syntax-delta-introducer trick Matthew pointed out to me the other day: (define-simple-macro (define-value/type-introducers value-introducer:id type-introducer:id) #:with scopeless-id (datum->syntax #f 'introducer-id) #:with value-id ((make-syntax-introducer #t) #'scopeless-id) #:with type-id ((make-syntax-introducer #t) #'scopeless-id) (begin (define value-introducer (make-syntax-delta-introducer #'value-id #'scopeless-id)) (define type-introducer (make-syntax-delta-introducer #'type-id #'scopeless-id)))) (define-value/type-introducers value-introducer type-introducer)


lexi.lambda
2017-10-27 18:24:52

By embedding the syntax objects in the resulting program and using make-syntax-delta-introducer, the scope is preserved across module instantiations.


lexi.lambda
2017-10-27 18:28:01

I just tried this approach, and it seems to work fine. It simplifies the implementation a lot, so I am leaning towards it—it eliminates the need for a patched version of racket/splicing and a reimplementation of module+ to cooperate with submodules.


notjack
2017-10-27 20:40:56

@samth saw racket/racket#1870, I’ve looked into racket on docker stuff a bunch and I’m curious what your plan is there


samth
2017-10-27 20:41:51

@notjack just using it in the linked repo for automated release testing purposes


notjack
2017-10-27 20:43:01

at a first pass I’m guessing the github issue is dockerfile related rather than racket related


notjack
2017-10-27 20:49:23

@samth Try changing the # mflatt section of the dockerfile to this:

CMD ["/racket-in-place/bin/racket", "-l", "tests/racket/test", "-l", "tests/htdp-lang/test-htdp", "-l", "tests/compiler/embed/test", "-f", "racket-test-core/tests/racket/pack.rktl"]

notjack
2017-10-27 20:50:01

then to run tests, run the command sudo docker build . -f Dockerfile-tests -t racket-test && sudo docker run racket-test


samth
2017-10-27 20:50:42

The GitHub issue fails if I connect to the image and run the command manually


notjack
2017-10-27 20:51:30

images and containers are different things - image is like binary you compile, container is like process you run


notjack
2017-10-27 20:51:58

that dockerfile is running the test command when you build the image, so you’re in “build mode” and have an AUFS filesystem that does weird things


notjack
2017-10-27 20:52:16

I think you want to run the tests inside a container spawned from the image instead


notjack
2017-10-27 20:52:37

containers are the only things you can connect / shell into, you can’t “connect” to an image


notjack
2017-10-27 20:55:01

(as an example of AUFS weirdness, putting RUN rm -rf /some/dir in a dockerfile does something that’s almost, but not quite, entirely unlike what you meant)


samth
2017-10-27 21:04:02

Sorry, what I mean is that if I run that docker file, and then connect to the resulting container, and then run the failing test, it continues to fail


samth
2017-10-27 21:04:12

Also, what should I do instead of rm?


samth
2017-10-27 21:04:46

Also, is there a way to roll back to an earlier point in the build inside a dockerfile?


notjack
2017-10-27 21:06:04

hmmm


notjack
2017-10-27 21:06:12

how familiar are you with docker?


samth
2017-10-27 21:39:14

@notjack I’ve written some docker stuff before, but only for basically scripting a container creation reproducibly


notjack
2017-10-27 21:42:00

@samth okay, so the most important thing to know is that you should assume containers have read-only filesystems and try and understand dockerfiles and the docker command line in terms of that


notjack
2017-10-27 21:42:29

more accurately, assume containers have immutable filesystems


samth
2017-10-27 21:42:41

Ok, that’s confusing since I can download and install things


notjack
2017-10-27 21:42:49

exactly


samth
2017-10-27 21:43:14

also, your suggested command also fails


notjack
2017-10-27 21:44:18

could you paste all output of the sudo <docker build+run> command?


samth
2017-10-27 21:47:18

basically just some cache hits and then the usual racket test output and then the error message



samth
2017-10-27 21:48:45

notjack
2017-10-27 21:49:54

@samth can you nuke your cache first? the output of each build step would be useful


samth
2017-10-27 21:50:06

remind me how to do that?


notjack
2017-10-27 21:50:14

docker build --no-cache


samth
2017-10-27 21:53:58

samth
2017-10-27 21:53:59

notjack
2017-10-27 21:57:09

@samth I don’t think I see error output in that log


samth
2017-10-27 21:57:26

yeah that’s because I failed to redirect stderr


samth
2017-10-27 21:57:32

it’s just the same last line


notjack
2017-10-27 21:57:41

ah okay


notjack
2017-10-27 21:58:11

I don’t know racket’s tests well enough to debug the specific failure, but I can give general docker guidance that will probably help


samth
2017-10-27 22:00:09

My suspicion is that it’s something to do with running as root or in /


notjack
2017-10-27 22:00:41

@samth Ah, then I probably know how to fix that. But first…


notjack
2017-10-27 22:11:08

@samth Think of containers as extremely well-isolated UNIX processes (possibly with subprocesses), and images as executables with metadata describing that isolation. Running a container involves choosing an image, setting up isolation described by that image, then running the image’s executable in that isolated environment. Network configuration, OS capabilities, user and group config, and what the filesystem looks like are all included in an image’s isolation metadata. This means that by default:

  • Attempting to write or create files in a container is only visible to processes inside that container and writes won’t persist after the container dies
  • The container has an isolated network with a different IP address than the IP address of the host machine the container is running on
  • The container runs as a root user, but this does not affect the container isolation. Images can further restrict this if they want by creating users and user groups and defining what user/group the container runs as when it first starts up.
  • Containers running on the same host share the operating system kernel (unlike VMs where each gets its own hypervisor) but syscalls and the like can be intercepted and restricted
  • All processes inside a container run in a single process group and the host may kill them all and restrict their resources arbitrarily
  • Images do clever things to make having lots of them cheap in terms of storage space, and containers are very cheap to start and run (unlike VMs)

samth
2017-10-27 22:15:02

Right, I understand a bunch about how containers work, but have not used them a huge amount (this is a common academic affliction)


notjack
2017-10-27 22:26:55

@samth Gotcha. So I think the part that’s confusing here is how a dockerfile gets turned into an image, and how an image describes the filesystem of containers run from it. An image has a list of layers, starting with the “base layer” which is empty(-ish), and each layer describes a filesystem diff from the previous layer. So images are like git repos, and if you take a base image (like ubuntu) and make ten different images that add 10MB of different stuff on top of it, you can cache all the layers in the ubuntu image when downloading those ten images.

Dockerfiles describe how to build images. Each RUN, ADD, and COPY command makes a new layer. So if you add a file in one RUN command, then remove it in the next, you don’t actually save any space in the image. In fact, you double the space taken up by the thing you wanted to remove, because now the image has to store it twice: once in a diff that adds it, and once in a diff that removes it.


samth
2017-10-27 22:29:50

right, that all makes sense


samth
2017-10-27 22:30:06

the reason I’m removing things in the other dockerfile in that repo is to have a clean state, not to save space


samth
2017-10-27 22:30:30

what I’d prefer to do is basically have the equivalent of slideshow 'alts for dockerfiles


samth
2017-10-27 22:30:57

IOW, download some stuff, and then say, first do this, and then go back to the layer after downloading and do this other stuff, etc


notjack
2017-10-27 22:33:32

Yeah docker does not encourage doing that within an image because saving space and structuring layers so you can cache them across different builds of different images is crucial. Instead, you can use “multi-stage builds” which let you define a pipeline of multiple different images in a single dockerfile and you can use files from one image as an input to building the next image.


notjack
2017-10-27 22:33:36

You do this by having multiple FROM commands



samth
2017-10-27 22:36:58

ok, that looks helpful


notjack
2017-10-27 22:43:04

other random tips:

  • Always use absolute paths to refer to stuff in the image’s filesystem, because otherwise you have to keep track of the current directory inside the image and the current directory outside the image while you’re building it. Gets messy fast.
  • Pay attention to how ENTRYPOINT and CMD are different, and always use “exec form”
  • Make sure to use the most recent stable versions of Docker and anything related to Docker, because the space is progressing so fast that a “best practice” from six months ago may easily be terrible advice today
  • Read this: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/

samth
2017-10-27 22:45:32

thanks


samth
2017-10-27 22:45:41

you can have a look at https://github.com/samth/docker-racket-build for where I currently am


notjack
2017-10-27 22:52:47

I’ve been peeking at it. FYI, I’ve got a repo (https://github.com/jackfirth/racket-docker) that builds docker images for already-released racket versions using the installers.


notjack
2017-10-27 22:53:06

but I do think racket should have an official docker image that’s built from source as part of its release process.


samth
2017-10-27 22:54:05

the goal here isn’t to produce anything for general consumption


samth
2017-10-27 22:54:14

but to have a nice contained way of doing testing


samth
2017-10-27 22:54:25

producing a docker image would be nice to do too


notjack
2017-10-27 22:54:51

baby steps :)


michael.ballantyne
2017-10-27 22:56:39

Is there some magic that prevents DrRacket from recompiling racket/base code with errortrace annotations? If I call a function in racket/base and it raises an error—perhaps I’ve called (first '())—the stacktrace doesn’t include frames inside the implementation of first. But if I define first myself in some file I require, it does include frames inside my implementation.


samth
2017-10-27 22:57:30

@notjack is there a reason that xvfb keeps randomly failing to start?


notjack
2017-10-27 22:59:50

@samth probably docker’s default security setup assumes you won’t be doing gui-like things in containers


samth
2017-10-27 23:00:06

answer, it doesn’t like being re-run in close succession with itself


royall
2017-10-27 23:01:46

notjack
2017-10-27 23:02:03

@samth also, docker does not give containers access to the gpu


samth
2017-10-27 23:02:18

I don’t think that’ll be a problem


notjack
2017-10-27 23:02:32

@royall…okay, I laughed at that one a bit too much


samth
2017-10-27 23:02:45

the whole thread is actually great


samth
2017-10-27 23:02:52

and not just for the joke


notjack
2017-10-27 23:05:33

how am I not already following this person


samth
2017-10-27 23:06:12

oh were you not already following david?


samth
2017-10-27 23:06:15

you should do that


notjack
2017-10-27 23:06:52

done


royall
2017-10-27 23:08:13

Racket users are the best thing on Twitter


royall
2017-10-27 23:08:18

besides dril, ofc


notjack
2017-10-27 23:12:19

added a :dril: emoji, you’re all welcome


notjack
2017-10-27 23:15:11

@samth did a little googlin’ and I think the Right Way for testing graphics stuff inside docker containers is to put the xvfb headless server inside its own separate container


notjack
2017-10-27 23:15:29

since X is a client server model anyways


samth
2017-10-27 23:27:58

@mflatt I just noticed that distro-build-test is not on http://pkgs.racket-lang.org\|pkgs.racket-lang.org, and that it’s info.rkt specifies a collection that’s probably not what’s intended (my guess is 'multi is intended)


samth
2017-10-28 00:09:39

@notjack I made you a collaborator in the hopes that you’ll fix all my bugs :slightly_smiling_face:


notjack
2017-10-28 00:38:47

@samth there’s been a change in Google’s FOSS policies so I might not be able to help much, unless you’re fine with patches being copyright Google instead of copyright me (they’d be under the same license either way)


samth
2017-10-28 02:19:10

I don’t particularly care who owns the copyright


Bot messages not yet supported
Bot messages not yet supported
notjack
2017-10-28 03:26:55

probably because docker uses the Open Containers Initiative standardized image format which many different container runtimes understand now