Skip to content

Instantly share code, notes, and snippets.

@enijar
Last active August 18, 2021 13:07
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 enijar/2d383920f6cfd828db463451a84fbcd2 to your computer and use it in GitHub Desktop.
Save enijar/2d383920f6cfd828db463451a84fbcd2 to your computer and use it in GitHub Desktop.

Mac Mini Installation Instructions

Instructions for getting the Mac Mini provisioned for running event applications.

Login

The username should be set to finervision. The password will be a generic password, and will need to be added to the company's 1Password vault.

IMPORTANT

Do not connect the machine to an Apple ID

System Preferences

General

General

Security & Privacy

Security & Privacy

Mouse

Mouse

Keyboard

Keyboard

Dock & Menu

Dock & Menu

SSH & Connecting to BitBucket

Generate keypair and copy it to the clipboard:

ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<<y >/dev/null 2>&1
cat ~/.ssh/id_rsa.pub | pbcopy

Add id_rsa.pub to BitBucket settings, giving it a label with the following format Mac Mini :id (Event Machine) (replace :id with the next number, e.g. 3).

Packages & CLI

Set the default terminal to bash:

chsh -s /bin/bash

Install Homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install required packages:

brew install node
sudo softwareupdate --install-rosetta
brew install touch-portal
brew install git-lfs
git lfs install --system

Install App(s)

Create an apps directory; this is where all apps will be installed and executed from:

mkdir ~/apps

Now cd into ~/apps and git clone the app into it's own directory, e.g.:

git clone git@bitbucket.org:FinerVision/facebook-area-404.git facebook-area-404

Run Touchscreen

Create the touchscreen directory:

mkdir ~/touchscreen

Copy package.json, config.json, and run.js into the ~/touchscreen directory. Then install packages:

npm --prefix ~/touchscreen install

Setup startup

pm2 startup

Then run the outputted script, generated from pm2.

Start the pm2 process:

pm2 start ~/touchscreen/run.js

Save the pm2 process to run on startup:

pm2 save
{
"url": "http://localhost:5000",
"start": "npx -y serve ~/apps/facebook-area-404/client/build",
"chromeExecutable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
}
{
"private": true,
"dependencies": {
"puppeteer": "^10.2.0",
"serve": "^12.0.0"
},
"devDependencies": {
"prettier": "^2.3.2"
}
}
const { exec } = require("child_process");
const puppeteer = require("puppeteer");
const config = require("./config");
const args = [`--app=${config.url}`, "--kiosk"];
async function cleanup(browser) {
try {
await browser.close();
} catch {
// Ignore errors
}
}
(async function start() {
exec(config.start, { stdio: "inherit" });
await new Promise((resolve) => setTimeout(resolve, 2000));
const browser = await puppeteer.launch({
headless: false,
handleSIGINT: false,
handleSIGTERM: false,
handleSIGHUP: false,
args,
executablePath: config.chromeExecutable,
});
browser.on("disconnected", () => cleanup(browser));
browser.on("targetdestroyed", () => cleanup(browser));
process.on("exit", () => cleanup(browser));
process.on("SIGINT", () => cleanup(browser));
process.on("SIGUSR1", () => cleanup(browser));
process.on("SIGUSR2", () => cleanup(browser));
process.on("uncaughtException", () => cleanup(browser));
const context = browser.defaultBrowserContext();
await context.clearPermissionOverrides();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment