Skip to content

Instantly share code, notes, and snippets.

@atuttle
Last active March 25, 2020 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atuttle/4c4b3c9d4f3cec46d59015a20750af24 to your computer and use it in GitHub Desktop.
Save atuttle/4c4b3c9d4f3cec46d59015a20750af24 to your computer and use it in GitHub Desktop.
A quick makefile for setting up Folding@Home on OSX

What is this?

It's a Makefile that sets up Folding@Home in a docker container on your computer. If you're not sure if you have Docker and Make available, this probably isn't for you.

Run make up to download and start the container. It should automatically figure out the UID and GroupID necessary to give the container access to write the data, assuming you're on OSX. I haven't tested it anywhere else.

Wherever you put the Makefile, it will create a folder named "data" as a sibling to the Makefile, and it will expose that folder into the component for Folding@Home to write into.

It's probably also worth noting that I've hard coded my personal time zone (America/New_York) into the docker create command, because I haven't found a good way to pull in the correct value dynamically, yet. (Know how? Hit me up!)

What about this is Mac OSX specific?

The container image we're using expects a UserId and GroupId from your host machine to give it the proper write access to save your data outside of the container. There is some syntax in the docker create command that I doubt will work on Windows. Heck, I don't even know if a UserId and GroupId are necessary on Windows. Try it and let me know?

You'll also want to change this part:

-v `pwd`/data:/config

... to mount the full path to your data folder as /config.

docker create --name=foldingathome -e PUID=999 -e PGID=888 -e TZ=America/New_York -p 7396:7396 -p 36330:36330 -v `pwd`/data:/config --restart unless-stopped linuxserver/foldingathome

And then?

After it's running, you can run make open to open the web client in your browser. This will allow you to set your name, team number, and passkey. (where do you get your passkey? here -- it will be sent to you by email. Sometimes it comes quickly, sometimes 12+ hours later.)

But why?

At this point I'm a full convert to Folding@Home -- might as well use it! But I was inspired to get involved by Covid-19. If you choose the option, "I support research fighting <Any Disease>" then some of the work units that get assigned to you might be for Covid-19 research. You'll probably get work units from other diseases too, but for now it's one way to help!

# https://hub.docker.com/r/linuxserver/foldingathome/
up: .setup
docker start foldingathome
open:
open http://localhost:7396/
down:
docker stop foldingathome
update:
docker pull linuxserver/foldingathome
docker stop foldingathome || exit 0
docker rm foldingathome
make .setup
docker image prune
docker start foldingathome
#create/setup
.setup:
mkdir data || exit 0
docker create --name=foldingathome -e PUID=`id | cut -d ' ' -f1 | cut -d '=' -f2 | cut -d '(' -f1` -e PGID=`id | cut -d ' ' -f2 | cut -d '=' -f2 | cut -d '(' -f1` -e TZ=America/New_York -p 7396:7396 -p 36330:36330 -v `pwd`/data:/config --restart unless-stopped linuxserver/foldingathome
touch .setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment