Skip to content

Commit fe42993

Browse files
authored
Update README with new instructions. (#12)
* Update README with new instructions. * Retain information on application usage and setup.
1 parent 837bd49 commit fe42993

File tree

1 file changed

+34
-80
lines changed

1 file changed

+34
-80
lines changed

README.md

+34-80
Original file line numberDiff line numberDiff line change
@@ -8,117 +8,68 @@ A simple, maybe not so simple clock replacement for the office of ACM@UIC.
88
* CTA Bus and Train Arrival Times
99
* Weather from DarkSky
1010

11-
## Using with docker
11+
# Building and deployment
1212

13-
1. `docker` and `docker-compose` should be installed.
14-
2. Download just the `docker-compose.yaml` file or clone the repository.
15-
3. Create a `.env` file based on `.env.example`.
16-
4. Run `docker-compose up -d` (Use `docker-compose up -d --build` instead to include local changes).
13+
This project is built and deployed with the Nix package manager. The NPM
14+
application can be built as follows:
1715

18-
To use `docker` without `docker compose`, run:
16+
```sh
17+
nix build .#
1918
```
20-
docker run -d -p 8080:8080 -e HTTPS="false" -e KEY="/root/ssl/ssl.key" -e CERT="/root/ssl/ssl.crt" -e PORT="8080" -e CTA_TRAIN_API_KEY="" -e CTA_BUS_API_KEY="" -e METRA_TRAIN_ID="" -e METRA_TRAIN_SECRET="" -e DARK_SKY_API_KEY="" -e COLORS="303030 01579B 006064 304FFE 004D40" -e BUS_STOPS="6700 6627 307 332 4640 14487 6347 206" -e TRAIN_STATIONS="40350" -e WEATHER_LAT_LONG="37.8267,-122.4233" -e UNITS="both" bmiddha/simple-js-clock
21-
```
2219

23-
## Installation
20+
This will produce a symlink called "result" in your local directory. The program
21+
can be run as follows:
22+
23+
```sh
24+
./result/bin/simple-ts-clock
25+
```
2426

25-
These steps seem to require python2, which does not ship with most linux distributions and is sunset. Therefore, it is recommended to run this app through docker instead (though of course, vulnerability will still exist - they will just be constrained to the container).
27+
## Usage
2628
1. Clone the repository.
2729
2. Navigate to the repository directory.
2830
3. Create a `.env` file based on `.env.example`.
2931
4. Run `npm install` to install dependencies.
3032

31-
## How to use
33+
### How to use
3234

3335
1. Run `npm run start` to start the npm server or `npm run watch` to watch for changes.
3436
2. Navigate the browser to `locahost:8080` or the port specified in the `.env` config.
3537

36-
## Offline Mode
38+
### Offline Mode
3739

3840
Offline mode will disable api requests to the server leaving only the clock running. It can be activated by going to `/offline` path.
3941

40-
## Demo Mode
42+
### Demo Mode
4143
Demo mode works like offline mode but displays demo information instead of real data from apis. It can be activated by going to `/demo` path.
4244

43-
## Configuration
45+
### Configuration
4446
To override the default config, you can use the URL GET parameters or by pressing `c` to open the config options.
4547

46-
# Deployment on a Raspberry PI
47-
48-
## Step 0: Install Packages
49-
```
50-
sudo apt update && sudo apt upgrade -y
51-
sudo apt install --no-install-recommends -y chromium-browser xserver-xorg x11-xserver-utils xinit
52-
```
53-
54-
## Step 1: Enable auto-login
55-
Use the `raspi-config` tool to enable auto-login to the console.
56-
`sudo raspi-config` => Boot Options => Desktop / CLI => Console Autologin
48+
## Deployment
5749

58-
## Step 2: Set console orientation
59-
Edit the file `/boot/config.txt`
60-
Add the following option:
61-
```
62-
display_rotate=3
63-
```
50+
To deploy to ACM's clock machine, simply run
6451

65-
```
66-
display_rotate=0 Normal
67-
display_rotate=1 90 degrees
68-
display_rotate=2 180 degrees
69-
display_rotate=3 270 degrees
52+
```sh
53+
./deploy
7054
```
7155

72-
## Step 4: `.xinitrc` file
56+
This repo is set to poll and auto upgrade the ACM clock machine every day
57+
automatically from the contents of this repo.
7358

74-
`/home/pi/.xinitrc`
75-
```
76-
#!/bin/sh
77-
xset -dpms
78-
xset s off
79-
xset s noblank
59+
To deploy outside ACM, first use [agenix](https://github.com/ryantm/agenix) to
60+
encrypt an env file containing the secrets (based on .env.example) replace the
61+
current `enc.env` file. You can encrypt your file to the SSH host key of the
62+
target machine. The `enc.env` file in the repo will decrypt on ACM's clock
63+
machine.
8064

81-
xrandr --output default --rotate left
65+
Then, edit the system configuration at `nix/system.nix` to your liking and
66+
deploy:
8267

83-
setxkbmap -option "terminate:ctrl_alt_bksp"
84-
85-
unclutter &
86-
chromium-browser http://server:8080 --window-size=1080,1920 --start-fullscreen --kiosk --incognito --noerrdialogs --disable-translate --no-first-run --fast --fast-start --disable-infobars --disable-features=TranslateUI --disk-cache-dir=/dev/null
8768
```
88-
Replace `http://server:8080` with nodejs server.
89-
90-
## Reboot
91-
92-
# Deployment on NixOS
93-
94-
## Step 0: Provision machine
95-
96-
This project follows a standard NixOS deployment process. Utilize the [`nixos/configuration.nix`](./nixos/configuration.nix) file to deploy a standard NixOS installation on a given machine. This sets up [cage](https://github.com/Hjdskes/cage) which is a Wayland kiosk application. The configuration is setup to launch Google Chrome and visit a local dockerized instance of the project.
97-
98-
## Step 1: Build the application
99-
100-
Build the application locally.
101-
102-
```bash
103-
docker build -t acm-uic/simple-ts-clock:latest .
69+
nixos-rebuild switch --flake .#acmclock --build-host root@yourmachine --target-host root@yourmachine
10470
```
71+
Make sure to change `system.autoUpgrade` to point to your repo, or disable it.
10572

106-
## Step 2: Setup environment secrets
107-
108-
Make a copy of the example `.env` file and populate the variables with the ones used for your setup.
109-
110-
```bash
111-
cp .env.example .env
112-
nvim .env
113-
```
114-
115-
## Step 3: Run Docker-compose
116-
117-
Run the application using docker-compose.
118-
119-
```bash
120-
docker-compose up -d
121-
```
12273

12374
# Authors
12475

@@ -127,3 +78,6 @@ This project was originally a rewrite of [sudoclock](https://github.com/acm-uic/
12778
The project has since been rewritten mostly in the [simple-js-clock](https://github.com/bmiddha/simple-js-clock) repo by [bmiddha](https://github.com/bmiddha) and other contributors.
12879

12980
In January 2023, the simple-js-clock repo was forked to continue development here.
81+
82+
In February 2025, @SohamG and @clee231 updated the app to Node 20 and added the
83+
Nix-based build and deployment.

0 commit comments

Comments
 (0)