Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .dockerignore

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
npm
*.log
9 changes: 0 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ cache:
- node_modules
- gui/node_modules
- server/node_modules
#sudo: required
#services:
#- docker
addons:
apt:
packages:
Expand All @@ -20,9 +17,3 @@ script:
- npm run test:ci
- npm run build
- npm run fixme
#- docker build --tag phjardas/tabidisco .
#deploy:
# provider: script
# script: bash docker_push.sh
# on:
# branch: master
26 changes: 0 additions & 26 deletions Dockerfile

This file was deleted.

10 changes: 10 additions & 0 deletions bin/tabidisco
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env node
'use strict';

const path = require('path');

process.title = 'tabidisco';
process.env.TABIDISCO_GUI_DIR = path.resolve(__dirname, '..', 'gui');
process.env.TABIDISCO_DB_DIR = process.env.TABIDISCO_DB_DIR || '/var/lib/tabidisco';

require('..');
60 changes: 60 additions & 0 deletions bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const fs = require('fs-extra');
const path = require('path');
const pkg = require('./package.json');

const root = __dirname;
const server = path.resolve(root, 'server');
const gui = path.resolve(root, 'gui');
const target = path.resolve(root, 'npm');

function copyFile(src, targetDir) {
const target = path.resolve(targetDir, path.parse(src).base);
return fs.copy(src, target);
}

async function writePackageJson() {
const pkg = { ...require(path.resolve(server, 'package.json')) };
['private', 'scripts', 'devDependencies', 'jest', 'main', 'typings'].forEach(f => delete pkg[f]);
pkg.scripts = { start: 'node index.js' };

const mainPkg = require('./package.json');
['name', 'version', 'description', 'homepage', 'bugs', 'license', 'author', 'contributors', 'repository', 'bin'].forEach(
f => (pkg[f] = mainPkg[f])
);

await fs.writeFile(path.resolve(target, 'package.json'), JSON.stringify(pkg, null, 2), 'utf-8');
}

async function main() {
await fs.emptyDir(target);
await fs.ensureDir(target);

// write package.json
await writePackageJson();

// write README.md
await fs.writeFile(
path.resolve(target, 'README.md'),
'# Tabidisco: Jukebox for kids powered by Raspberry Pi\n\nThis is the GUI for [Tabidisco](https://github.com/phjardas/tabidisco).\n',
'utf-8'
);

// copy server files
await fs.copy(path.resolve(server, 'dist'), target, {
filter: f => !f.endsWith('.ts') && !f.endsWith('.map'),
});

// copy GUI files
await fs.ensureDir(path.resolve(target, 'gui'));
await fs.copy(path.resolve(gui, 'dist'), path.resolve(target, 'gui'));

// copy bin files
await fs.copy(path.resolve(root, 'bin'), path.resolve(target, 'bin'));
}

main()
.then(() => console.log('DONE'))
.catch(err => {
process.exitCode = 1;
console.error('ERROR:', err);
});
3 changes: 0 additions & 3 deletions docker_push.sh

This file was deleted.

39 changes: 11 additions & 28 deletions docs/INSTALLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,10 @@ npm install -g npm@latest

## Initial setup

Clone the tabidisco repository on your Pi into `/home/pi/tabidisco`:
Install Tabidisco globally:

```
git clone https://github.com/phjardas/tabidisco.git ~/tabidisco
```

Create a directory to store persistent data (eg. MP3 files):

```
mkdir -p ~/tabidisco-data
```bash
npm install --global tabidisco
```

Create a startup script at `/home/pi/tabidisco.sh`:
Expand All @@ -70,20 +64,13 @@ Create a startup script at `/home/pi/tabidisco.sh`:
#!/bin/bash
source ~/.nvm/nvm.sh
nvm use 8
npm start

export NODE_ENV=production
tabidisco
```

and make it executable: `chmod +x ~/tabidisco.sh`.

Create the file `/etc/default/tabidisco` with the following content:

```
NODE_ENV=production
PORT=3000
TABIDISCO_GUI_DIR=/home/pi/tabidisco/gui/dist
TABIDISCO_DB_DIR=/home/pi/tabidisco-data
```

Create the file `/etc/systemd/system/tabidisco.service` with the following content:

```
Expand All @@ -94,13 +81,11 @@ After=network.target

[Service]
ExecStart=/home/pi/tabidisco.sh
WorkingDirectory=/home/pi/tabidisco/server
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=tabidisco
EnvironmentFile=/etc/default/tabidisco

[Install]
WantedBy=multi-user.target
Expand All @@ -112,15 +97,13 @@ Now enable the service to start on boot:
sudo systemctl enable tabidisco.service
```

## Deployment
You can now access tabidisco on your Pi's IP address at port 3000.

Everytime you want to deploy the newest version (including the first time) run the following commands:
## Updating

When you want to update your installation of Tabidisco to the latest version, run the following script:

```bash
cd ~/tabidisco
(cd gui && npm ci && npm run build)
(cd server && npm ci && npm run build)
npm install --global tabidisco@latest
sudo service tabidisco restart
```

You can now access tabidisco on your Pi's IP address at port 3000.
16 changes: 13 additions & 3 deletions gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,27 @@
"env",
{
"targets": {
"browsers": ["last 2 versions"]
"browsers": [
"last 2 versions"
]
},
"modules": false
}
],
"react"
],
"plugins": ["transform-object-rest-spread", "transform-class-properties"],
"plugins": [
"transform-object-rest-spread",
"transform-class-properties"
],
"env": {
"test": {
"presets": [["env"], "react"]
"presets": [
[
"env"
],
"react"
]
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 25 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
{
"name": "tabidisco",
"version": "0.1.0",
"private": true,
"version": "0.1.0",
"description": "Jukebox for kids powered by Raspberry Pi",
"homepage": "https://github.com/phjardas/tabidisco",
"repository": {
"type": "git",
"url": "https://github.com/phjardas/tabidisco"
},
"bugs": {
"url": "https://github.com/phjardas/tabidisco/issues"
},
"license": "MIT",
"author": {
"name": "Philipp Jardas",
"email": "philipp@jardas.de",
"url": "https://github.com/phjardas"
},
"scripts": {
"postinstall": "check-engine && (cd gui && npm install) && (cd server && npm install)",
"build": "(cd gui && npm run build) && (cd server && npm run build)",
"build": "check-engine && (cd gui && npm run build) && (cd server && npm run build)",
"start": "check-engine && concurrently --kill-others 'npm run start:server' 'npm run start:gui'",
"start:server": "(cd server && npm run dev)",
"start:gui": "(cd gui && npm start)",
Expand All @@ -19,11 +34,18 @@
"check-engine": "^1.7.0",
"concurrently": "^3.5.1",
"fixme": "^0.4.5",
"fs-extra": "^5.0.0",
"husky": "^0.14.3",
"lint-staged": "^7.0.0",
"prettier": "^1.11.1"
},
"bin": {
"tabidisco": "./bin/tabidisco"
},
"lint-staged": {
"{server,gui}/src/**/*.{ts,tsx,js,jsx,json,css}": ["prettier --write", "git add"]
"{server,gui}/src/**/*.{ts,tsx,js,jsx,json,css}": [
"prettier --write",
"git add"
]
}
}
5 changes: 5 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -e
npm install
npm run build
node bundle.js
(cd npm && npm publish)