-
Notifications
You must be signed in to change notification settings - Fork 3
Implement releases using Docker #33
Comments
Need to access config/ folder inside the Dockerfile that is in static/ folder.
(ie, VOLUME ~/git/fox/:/containerdir/ is illegal) For security reasons, you can not do ADD ../aa /static either (add parent directories -- since they are outside of the build context) |
One possible solution was (which necessitates .dockerignore in /fox) this: moby/moby#2745
|
This is not the best solution, since it uses data only containers (Docker Compose file ver 2 seems to have deprecated these with named volumes). A better idea seems to give the dockerfile (in static/) the project's root as the build context (so it could access both static/ and config/). The implementation of this concept can be seen at 4528de3 |
Links and "expose" (similar to "ports" command, but does not publish ports to host machine) can be considered deprecated features since Docker 1.9 (and should not be used, when writing Docker Compose files of ver 2). Networks should be used instead. However:
Implementation of user-defined bridge networks and loadbalancers: https://docs.docker.com/engine/userguide/networking/dockernetworks/ |
Building go files inside a Docker container with The solution is quite simple: we just build a similar directory structure inside the container and only copy the files we need, with a small caveat -- we will use the vendor directory for local pkg's local dependencies.
For example, to build Loginservice, we copy authn, authz and util into the vendor folder, instead of directly into the source directory (a small difference, but it makes it clear that these are the external dependencies of pkg login).
As of July 2016, the "dependency management"/"go vendoring" tools are not mature enough for use in production, so, in order to get all the dependencies required for a build, we will have to copy these manually from the host's (from the point of view of the Docker container) source directory into the container's vendor directory and use For reference: |
It turned out there was no merit in doing this. One thing that might be confusing is that we no longer import fox as "fox", but as "github.com/e-gov/fox". This, while it might seem so, is not an external import (the missing "src/" directory being the key indicator of that -- if we delete the folder in github.com, "go get" will not recover the deleted files). This confusion came about because we moved local packages into canonical github.com/e-gov, which meant changes in config files, scripts and src code.
We do not want to copy the whole project into the Docker container due to 'go get' using GOPATH (which, by default, is the project root) as mentioned in #33. We don't need the vendor folder to pull this off, but it makes more clear which pkgs are considered 'external'.
We build go binaries using static linking (CGO=0), which means that os/user package does not work. Thus, we cannot create a separate config folder for Docker in config, because getUserConfigFolderPath in Config.go will not work without knowing the user name -- which we use os/user for. That means, we have to rely on the fallback version to be there. #33
For haproxy logging, we used rsyslog and mounted /dev/log on the haproxy containers, which means we can read the log at /var/log/syslog References: |
Create a network so that static_web proxies go through load balancers |
The request from inside static_web (see docker-compose.yml) to fox_LB (LB stands for load balancer, see fox_LB/haproxy.cfg) goes through a nodejs proxy that uses CORS (changeOrigin is set to true in static/properties.sample.json). This means that the request port is changed and we have to rely on the request's URL path to decide which backend to send the request. In the case of fox service, it seems that frontend balancer can listen on 8090, but the ACL, defined inside the balancer (see the fox_LB/haproxy.cfg), uses the new port assigned due to CORS. #33
set the correct status check address for balancers 3468583 |
Implement a release process that results in a bunch of docker containers encapsulating the following parts of the system:
The text was updated successfully, but these errors were encountered: