Head in the Cloud

My journey to work in cloud technology

Running radiusd as a container on Mac OS X: the problems

December 18, 2018 · AWS, Docker

So far, the radiusd experiment is working, but as I try to expand the feature set I am hitting some roadblocks. At this point, I have 4 working instances of radiusd running and responding to radtest commands, but deploying everything is taking a lot of command line intervention.

The process I have so far is as follows:

  • copy archive of working raddb directory to each server running docker
  • decompress archive to same place
  • run the radiusd container in interactive mode, otherwise it shuts down and I can't get the subsequent commands to work correctly:
docker run -it --name radiusd -p 1812:1812 -p 1813:1813 -p 1812:1812/udp -p 1813:1813/udp  soops/radiusd bash
  • From a new terminal, copy the raddb directory contents to the container
docker cp Desktop/etc/raddb/. radiusd:/etc/raddb
  • Fix the ownership issue
docker exec radiusd chown -R radiusd:radiusd /etc/raddb
  • Start the service
docker exec radiusd service radiusd start
  • Tail the log to see if the requests are coming through
docker exec radiusd tail -f /var/log/radius/radius.log

Definitely the clumsy way to do it. Also, I have a weird situation where one instance logs just fine, while the others do not show anything in the log beyond the initial 3 lines of radius saying it is ready to go. I need to get that figured out, since logging is kinda importante.

I tried to use the awslogs service so that Docker would send my logs to my Cloudwatch, but I can't get the credentials to be recognized.

docker run -d --name radiusd -p 1812:1812 -p 1813:1813 -p 1812:1812/udp -p 1813:1813/udp --log-driver=awslogs --log-opt awslogs-region=us-west-2 --log-opt awslogs-group=bccsDocker --log-opt awslogs-create-group=true -soops/radiusd

Everything looks like it will work as I get a container ID, and then I get:

docker: Error response from daemon: failed to initialize logging driver: NoCredentialProviders: no valid providers in chain. Deprecated.
For verbose messaging see aws.Config.CredentialsChainVerboseErrors.

So far, it looks like an issue with Docker for Mac not exporting the aws credentials effectively. Every time I try to add directives to the daemon.json file via the app Preferences / Daemon window, it breaks the whole install and I have to reset and rebuild my images. So, this one is going to take some experimenting.

The other problem to solve is how to automate the deployment of all of these steps. At this point, there are a couple of ways to handle it:

  • A script that pulls the raddb directory from our private repository, copies it to each server, deletes the old container, rebuilds the new, copies the directory, fixes the perms and starts the service. Workable but highly inefficient.
  • Try to get all of these Mac nodes to work together as a kubernetes cluster or a swarm, and run radiusd as a service. Better, but adds a layer of complexity I am not ready to tackle, just yet, although I'm taking a docker certification course, so it might be worthwhile to try the swarm.
  • Get Jenkins to handle the automation. This looks to be the best bet, so I'll attack this next.