{"id":15142410,"url":"https://github.com/jambrain/dairybox","last_synced_at":"2025-07-28T01:34:24.023Z","repository":{"id":31118830,"uuid":"34678359","full_name":"JamBrain/DairyBox","owner":"JamBrain","description":"Local development VM and tools for Jammer Core","archived":false,"fork":false,"pushed_at":"2022-03-05T21:15:33.000Z","size":229,"stargazers_count":35,"open_issues_count":3,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-14T13:39:33.725Z","etag":null,"topics":["jammer","jammer-bio","jammer-tv","ldjam","ludumdare","vagrant","vagrant-boxes"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Wasuregusa/persona-fusion-calculator","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamBrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-27T16:39:04.000Z","updated_at":"2024-12-04T10:40:21.000Z","dependencies_parsed_at":"2022-09-08T21:01:29.272Z","dependency_job_id":null,"html_url":"https://github.com/JamBrain/DairyBox","commit_stats":null,"previous_names":["jambrain/dairybox","jammercore/dairybox"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JamBrain/DairyBox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamBrain%2FDairyBox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamBrain%2FDairyBox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamBrain%2FDairyBox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamBrain%2FDairyBox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamBrain","download_url":"https://codeload.github.com/JamBrain/DairyBox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamBrain%2FDairyBox/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267451146,"owners_count":24089293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jammer","jammer-bio","jammer-tv","ldjam","ludumdare","vagrant","vagrant-boxes"],"created_at":"2024-09-26T09:41:26.872Z","updated_at":"2025-07-28T01:34:23.989Z","avatar_url":"https://github.com/JamBrain.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DairyBox\n\u003cimg align=\"right\" src=\"https://raw.githubusercontent.com/JammerCore/DairyBox/gh-pages/assets/Logo.png\"\u003e\n\nDairyBox is the web development toolchain for **Jammer Core**, the software powering **Ludum Dare** events. To make contributions, you will be using this suite of tools.\n\n**IMPORTANT UPDATE 2022**: Elements of DairyBox are end of life (EOL), unsutable for production, but still usable for development. We will take steps to correct this, but do understand the tooling is a bit out-of-date.\n\n\n### DairyBox uses\n* **Vagrant** - A set of tools for automating and controlling Virtual Machines (VMs)\n* **Virtual Box** - for hosting and running those Virtual Machines\n* **Scotch/Box** - a flexible preconfigured LAMP VM for Vagrant (Linux+Apache+MySQL+PHP)\n\nThe live servers **don't** run a LAMP stack, but instead run a similar bleeding-edge configuration (Linux+OpenLiteSpeed+MariaDB+PHP7).\n\n**UPDATE 2022**: The live servers currently run some more akin to a LEMP stack (Linux+NginX+MariaDB+PHP8), but that doesn't do it justice. I'll link to a more detailed architecture breakdown in the future.\n\n\n## What? Explain working with Vagrant and Scotch/Box\nThe key thing to understand about working with Vagrant boxes (VMs) like Scotch/Box is that Vagrant boxes are temporary. Though you can connect to the Virtual Machine and install whatever you like, Vagrant boxes work best when you install things via setup scripts. That way, they can be *nuked from orbit* whenever you like, giving you fresh/clean install whenever you want one.\n\nIn the case of Scotch/Box, the important files (i.e. the website) lives on your local machine. The Scotch/Box VM is pre-configured with a share to those files. You simply edit the files in the `www` folder, refresh your browser to see the changes, and commit/push your changes to your GIT repository once you're happy with them. Easy.\n\nSince the files are NOT on the VM, you can safely `vagrant destroy` whenever you need to update DairyBox.\n\n\n## I still don't understand\nYou're running a fake computer on your computer. That fake computer runs Linux. We installed everything for you, and if you break it, you can *push a button* (Vagrant) to get a brand new fake computer. You can destroy and create that fake computer as many times as you want.\n\nOnce set up, DairyBox will serve web pages to you. All you have to do is edit files and refresh your browser any time you change something. And if it ever stops working, you can blow up your fake computer using *the button* (Vagrant) and get a new one (though you probably just need to restart it).\n\nWe call that editing, clicking, and blowing up computers *the workflow*.\n\nWe call the stuff you download and install *the toolchain*.\n\n\n# Pre Setup (Part 0)\nFirst, you may need to enable virtualization support in your BIOS. How you do this will depend on your computer model or motherboard. A good place to start is Google:\n\nhttps://www.google.com/#q=enable+virtualization\n\n**ALWAYS** install the latest versions of software. If something ever stops working, make sure you **are** running the absolute latest version.\n\n1. Install **GIT**: http://git-scm.com/downloads (*)\n2. Install **Virtual Box**: https://www.virtualbox.org/wiki/Downloads (***)\n3. Install **Vagrant**: http://vagrantup.com/ (***)\n4. Install **Vagrant-Exec** plugins:\n\n    ```sh\n    vagrant plugin install vagrant-exec\n    ```\n\n\n### Linux Notes (***)\nIf you're an Ubuntu/Debian user, **DON'T INSTALL VAGRANT AND VIRTUAL BOX USING APT-GET**! The repositories for these are **VERY** out of date. Most Vagrant setup problems on Linux are because you don't have the latest version.\n\nIf you're on Arch Linux, you will need the **net-tools** package to make Vagrant work right. See [here](https://wiki.archlinux.org/index.php/Vagrant#No_ping_between_host_and_vagrant_box_.28host-only_networking.29).\n\n\n### Windows Notes (*)\nDairybox on Windows works _best_ with a Unix environment. The latest version of **GIT** includes one (Based on **MSys**). Launch the **GIT Bash** shell to use it (may require a reboot).\n\n**IMPORTANT**: You **MUST** run your shell as an **ADMINISTRATOR**!! This is **REQUIRED** for symlinks to work correctly.\n\nYou _can_ use the standard Windows **command prompt**, but you will need an **SSH** client to connect and build the project.\n\n**IMPORTANT 2**: On Windows, you will run in to issues if the directory you are working out of has a space in it. You may have done this unwillingly, if you're working on your Desktop and your Windows username has a space in it.\n\nIn this case, it's recommended you create and work out of a folder on the root of your `C` drive. In the **GIT Bash** shell, this could be `/c/ludumdare/`.\n\n\n# Setup Part 1: DairyBox\nClone the **DairyBox** repo.\n\n**EXAMPLE:**\n\n```sh\ngit clone https://github.com/ludumdare/dairybox.git ludumdare\n```\nwhere `ludumdare` is the directory you plan to work out of.\n\n**NOTE:** DairyBox is the toolchain. For convenience, we use GIT to download and install it. Most people don't need a Fork of DairyBox. Upgrades are MUCH simpler if you don't.\n\n**DO NOT** do a `vagrant up` yet. We have one more step...\n\n\n# Setup Part 2: Source\nEnter the `www` directory, initialize a new repository there, and set the origin to your source repository.\n\nIf you just want to try it out, or don't yet have a GitHub account, you can do the following.\n\n```sh\ncd www\ngit init\ngit remote add origin https://github.com/ludumdare/ludumdare.git\ngit fetch\ngit checkout -t origin/master\n```\n\nIf you do plan to contribute changes, **fork** the `/ludumdare/ludumdare` repostiory.\n\nYou should also set up [SSH with GitHub](https://help.github.com/articles/which-remote-url-should-i-use/#cloning-with-ssh-urls) ([more info](https://help.github.com/categories/ssh/)), as it makes everything simpler (no need to generate tokens).\n\nThe recommended checkout should look something like this.\n\n```sh\ncd www\ngit init\ngit remote add origin git@github.com:YOUR-USER-NAME-ON-GIT/ludumdare.git\ngit remote add upstream https://github.com/ludumdare/ludumdare.git\ngit fetch\ngit checkout -t origin/master\n```\nVery important: don't forget the `-t`, else you'll be left with a detached head.\n\n\nThis will make committing your changes, and merging upstream changes easier.\n\nWe will be working in the `www` directory.\n\n\n# Setup Part 3: Vagrant Up\nDo a `vagrant up`.\n\nSetup should take about 4 minutes, but longer on a brand new install (lots of downloading).\n\nAfter setup, you'll be able to access VM's sandbox folder here: http://192.168.56.48. It may take a moment to connect.\n\nThe following domains have been configured to point to the VM running on your local machine:\n* http://ldjam.work - **ldjam.com** (`www/public-ludumdare.com`)\n  * http://api.ldjam.work - **api.ldjam.com** (`www/public-api`)\n  * http://url.ldjam.work - **ldj.am** (`www/public-url.shortener`)\n* http://jammer.work - **jammer.vg** (`www/public-jammer.vg`)\n  * http://api.jammer.work - **api.jammer.vg** (`www/public-api`)\n  * http://url.jammer.work - **jam.mr** (`www/public-url.shortener`)\n* http://bio.jammer.work - **jammer.bio** (`www/public-jammer.bio`)\n  * http://api.bio.jammer.work - **api.jammer.bio** (`www/public-api`)\n* http://static.jammer.work - **static.jam.vg** (`www/public-static`)\n\nTesting on remote machines and mobile devices is a bit more effort. See the [Public Server](#public-server) section below.\n\nFor details on the **Jammer/Ludum Dare** source tree, visit:\n\nhttps://github.com/ludumdare/ludumdare\n\n\n# Using Dairybox\n## Building the Source Code and SVG Assets\nThere are two ways to build the source code and assets.\n\n1. From inside the VM\n2. From outside the VM (Linux/Mac only)\n\nCommon to both methods is how you build.\n\n* `make` to compile the latest changes to the project\n* `make clean` to destroy all files, and start over\n\n\n### Building inside the VM\nThis is ready to-go after setup. Simply do the following.\n\n```sh\nvagrant ssh\ncd ~/www\nmake\n```\nThis compiles from inside the VM. You can repeat running `make` as many time as you like thereafter.\n\nWith the source built and the VM running, you can now view your instance in a browser at http://ldjam.work\n\n\n### Building outside the VM\nSee [wiki/External-VM-Builds](https://github.com/ludumdare/dairybox/wiki/External-VM-Builds)\n\n\n## Updating the database tables\n**IMPORTANT**: When you've been working a while, ocassionally you will need to update the database tables.\n\nYou can do this by running this command:\n\n```\nsudo ~/db-create.sh\n```\n\nIf you're working outside the VM, a version of `db-create.sh` can be found in the DairyBox folder (i.e. `../db-create.sh`).\n\n\n## Merging Upstream\nGitHub will often complain that your version is behind master. To merge the latest changes, do the following:\n\n```sh\ngit fetch upstream\ngit checkout master         # this can be omitted if you're not working out of a branch\ngit merge upstream/master\n\ngit push -u\n```\n\nhttps://help.github.com/articles/syncing-a-fork/\n\nhttps://help.github.com/articles/merging-an-upstream-repository-into-your-fork/\n\n\n## Cherry-Picking\nIf you've made several changes and want to make a patch for specific changes, you can use Git's cherry-pick feature.\n\n```sh\n# setup\ngit checkout -b mybranch\ngit fetch upstream\ngit reset --hard upstream/master\n\n# for each change you want to add to this branch\ngit cherry-pick \u003ccommit-hash\u003e\n\n# when ready to commit\ngit push origin mybranch:mybranch\n\n# when finished, and you want to return to origin\ngit checkout master\n```\n\nReference: http://stackoverflow.com/a/25955829/5678759\n\n\n## Upgrading DairyBox\nFrom your root working directory (not `www`).\n* Destroy your VM with `vagrant destroy`. This shuts down the server and removes the VM.\n* Pull the latest changes with `git pull -u`.\n* Update your Vagrant boxes (i.e. Scotch/Box) with `vagrant box update`.\n* Initialize a fresh VM with `vagrant up`.\n\nIf however you forked Dairybox, you will have to do something like above (Merging Upstream).\n\n\n# Tips\nYou should **suspend** the VM before put it to sleep (or close the lid). If you forget, do a `vagrant suspend` then a `vagrant up` to resume the server.\n* `vagrant up` to initialize, start, or resume a server (after suspending or rebooting)\n* `vagrant suspend` to put it to sleep\n* `vagrant halt` to shut it down (power button)\n* `vagrant reload` to restart it\n* `vagrant destroy` to delete the VM (the files in www are fine, but everything else is lost)\n* `vagrant ssh` to connect to the VM with SSH\n\n\n## Utilities\n### Local Utilities\nWith **Vagrant-Exec** installed, these shell scripts are available in the Dairybox folder.\n* **info.sh** - Get information about the VM. IP addresses, etc.\n* **log.sh** - Get the Apache+PHP Log (use PHP function \"error_log\" to send errors here).\n\n\n### Config File Symlinks\nIf you do a `vagrant ssh`, inside your home directory (`~`), you'll find symlinks to configuration files for the various software run on the webserver.\n* **~/php.ini** - PHP Configuration\n* **~/user.ini** - **OTHER** PHP Configuration. This is the config that enables debugging, etc.\n* **~/apache2.conf** - Apache Configuration\n* **~/mysql.conf** - MySQL Configuration (NB. file is actually named `my.cnf`, but symlinked with a better name)\n\nAlso, for convenience, there are symlinks to the following helpful folders:\n* **~/www/** - to the WWW root folder\n\n\n### Web Utilities\nThese are some pre-installed tools you can access with your browser. Helpful for debugging.\n* http://192.168.56.48/dev/ (`../dev/`)\n  * **apcu.php** - Manage APCu state (fast RAM cache) - login: **root**  password: **root**\n  * **ocp.php** - Manage Opcache state (PHP Opcache)\n  * **phpinfo.php** - Simple script with a phpinfo() call.\n  * **phpmyadmin/** - Manage the Databases - login: **root**  password: **root**\n\nData can be found in the `scotchbox` database.\n\n\n## Public Server\nBy default, your DairyBox can only be accessed on the local machine. To access it from another machine or device on your network, you need to enable the _Public Server_, and either edit your router or remote devices `.hosts` file. If you don't have SSH access or another way to change the `.hosts` file of your router/device, you **will not** be able to do this.\n\nTo start, remove the # in front of the `\"public_network\"` line in your **Vagrantfile** (`/Vagrantfile`).\n\nThe next time you start your server with `vagrant up`, you may be prompted which of your Network Interfaces you want to bind (i.e. your Ethernet or your WiFi). For me I choose the ``1`` option, but YMMV.\n\nOnce setup completes, you can use the info script to fetch the public IP address of the server.\n\n```sh\n./info.sh\n```\n\nThe public IP is usually the IP listed under **eth2**.\n\nThe public IP address is needed to connect to the VM remotely. The domains, `jammer.work` and `ldjam.work` are configured for the default local IP address (`192.168.56.48`), and can't be used for this.\n\nYou can change the `.hosts` file of your local internet router. For details, go here:\n\nhttps://github.com/ludumdare/ludumdare/wiki/Testing-on-Mobile\n\nAlternatively, you can change the `.hosts` file of your device. Unfortunately this can mean _jailbreaking_ your phone, so modifying the `.hosts` file of the router is preferred.\n\nAdd the following domains to the `.hosts` file, and make them point to the VM's LAN IP address (**NOT** 192.168.56.48, but the IP returned by `info.sh` above).\n\n* http://ludumdare.dev - **ludumdare.com** (`www/public-ludumdare.com`)\n  * http://api.ludumdare.dev - **api.ludumdare.com** (`www/public-api`)\n  * http://url.ludumdare.dev - **ldj.am** (`www/public-url.shortener`)\n* http://jammer.dev - **jammer.vg** (`www/public-jammer.vg`)\n  * http://api.jammer.dev - **api.jammer.vg** (`www/public-api`)\n  * http://url.jammer.dev - **jam.mr** (`www/public-url.shortener`)\n* http://bio.jammer.dev - **jammer.bio** (`www/public-jammer.bio`)\n  * http://api.bio.jammer.dev - **api.jammer.bio** (`www/public-api`)\n* http://static.jammer.dev - **static.jam.vg** (`www/public-static`)\n\n\n## Enabling OpCache\nYou should only enable OpCache if you need to better simulate the active **Ludum Dare** server environment, or test OpCache aware features. For most developers, it's preferred that your PHP scripts aren't cached. That way, they reload whenever you refresh your browser.\n\nYou can clear the OpCache cache and look-up other details using the OCP tool:\n\nhttp://192.168.56.48/dev/ocp.php\n\nTo Enable OpCache, do the following:\n\n```sh\nvagrant ssh\nsudo nano ~/user.ini\n```\n\nEnable it by changing the `opcache.enable` line like so:\n\n```\nopcache.enable=1\n```\n\nSave and close the file (`CTRL+O, ENTER, CTRL+X`). Restart Apache.\n\n```sh\nsudo service apache2 restart\n```\n\n**NOTE:** You can find other configuration settings here:\n\nhttp://php.net/manual/en/opcache.configuration.php\n\n\n## Configuring APCu (Memory Cache)\nAPCu comes pre-configured in DairyBox.\n\nThe **Ludum Dare** website requires APCu. APCu is faster than Memcached (shared data is written directly to RAM instead of being piped over TCP), but is unreliable when it comes to scaling across multiple servers. Data that must be real-time accurate across multiple servers should not be cached by APCu. That said, a lot of **Ludum Dare** data can safely be wrong and out of date. For example: Changes to data **must** be read and written to the database, but data fetched by users browsing the website (comments, posts, likes, links, etc) can safely be out-of-date. In practice, the worst case has data out-of-date for a few minutes, but in many cases it wont even be a second.\n\nFor caching advice, see the Development Guide.\n\nYou can check what's cached and how much memory is used with the ACPu tool:\n\nhttp://192.168.56.48/dev/apcu.php\n\nTo change setting (memory usage, etc), do edit `~/user.ini`.\n\n**NOTE:** By default, we are not changing any of the default settings. You can find a list of possible options here:\n\nhttp://php.net/manual/en/apcu.configuration.php\n\n\n## Configuring e-mail for testing\nYou can monitor outgoing e-mails using MailHog here:\n\nhttp://192.168.56.48:8025/\n\nAny emails generated by the server will be caught and displayed there.\n\n\n## Testing legacy Internet Explorer versions\n**UPDATE 2022**: We are no longer supporting Internet Explorer.\n\nMicrosoft offers a variety of Virtual Machines for testing Internet Explorer 8-11 on Windows 7 and 8, as well as Microsoft Edge on Windows 10. The toolchain is already using VirtualBox, so it makes sense to grab VirtualBox images.\n\nhttps://developer.microsoft.com/en-us/microsoft-edge/tools/vms/\n\nUnzip the downloads, and double click the `.ova` files to install them in VirtualBox.\n\nWindows XP and Vista VM downloads are no longer officially available (with IE7 and IE8), but can be downloaded here:\n\nhttps://github.com/magnetikonline/linuxmicrosoftievirtualmachines#ie8---xp\n\n**NOTE**: Be sure to snapshot the VMs **BEFORE** starting them for the first time. The VMs use un-activated versions of Windows, and will expire after 30-90 days. With a snapshot, you can roll-back the VM and get a new 30-90 days.\n\n\n## Working Offline\nTo work offline we must add the following to the hosts-file:\n\n```\n# For LudumDare Development\n192.168.56.48 ldjam.work\n192.168.56.48 api.ldjam.work\n192.168.56.48 url.ldjam.work\n192.168.56.48 jammer.work\n192.168.56.48 api.jammer.work\n192.168.56.48 url.jammer.work\n192.168.56.48 bio.jammer.work\n192.168.56.48 api.bio.jammer.work\n192.168.56.48 static.jammer.work\n```\n\n**Note** that this must be commented out or removed for testing to be online again.\n\nOn windows in `git bash` as **administrator** you can edit it by:\n\n```\nvi /c/Windows/System32/drivers/etc/hosts\n```\n\n\n## When your box stops working.\n1. Navigate to where you usually do `vagrant up`\n2. If your box is running `vagrant halt`\n3. Do `vagrant box list`, this should show you a `scotch/box`\n4. Do `vagrant box remove scotch/box`. This will give you some information about an environment using the box and asking if you are really sure. Say `N`.\n5. Use that long environment hex to destroy the environment: `vagrant destroy 00d3488f41fa40998bfe16ada2ebfd31` **but using your environment id**\n6. Now with the environment destroyed you can do `vagrant box remove scotch/box`\n7. And finally you can do `vagrant up` (this will take a long time again) and things should work nicely.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjambrain%2Fdairybox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjambrain%2Fdairybox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjambrain%2Fdairybox/lists"}