Skip to content

Commit

Permalink
Add docker compose file
Browse files Browse the repository at this point in the history
  • Loading branch information
vergissberlin committed Nov 26, 2018
1 parent 9dfc177 commit a3e63f2
Show file tree
Hide file tree
Showing 48 changed files with 3,221 additions and 986 deletions.
24 changes: 24 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Network name
#
# Your container app must use a network conencted to your webproxy
# https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
#
NETWORK=webproxy

# Your domain (or domains)
DOMAINS=your-domain.eu

# Your email for Let's Encrypt register
LETSENCRYPT_EMAIL=info@andrelademann.de

# NodeRED
ADMIN_USERNAME=
ADMIN_PASSWORD=
SECRET=
PORT=1880


# Mongo
MONGO_INITDB_ROOT_USERNAME=xxx
MONGO_INITDB_ROOT_PASSWORD=xxx
28 changes: 24 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
.git
.idea
.sass-cache
/node_modules/
/*

!/app
!/build
!/config
!/data
!/docs
!/private
!/public
!/setup
!/tests
!/*.dist
!/.gitignote
!/.scss-lint.yml
!/docker-compose.yml
!/docker-compose.development.yml
!/Dockerfile
!/Gruntfile.js
!/LICENSE
!/packackage-lock.json
!/package.json
!/README.md

/data/projects/.sshkeys
6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

18 changes: 0 additions & 18 deletions .idea/raspberry-coffee.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

14 changes: 0 additions & 14 deletions .resin-sync.yml

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM nodered/node-red-docker

USER root

RUN apt-get update &&\
apt-get install -y \
curl \
git-core \
mc \
vim \
wget

USER node-red

RUN npm install \
node-red-dashboard \
node-red-node-mongodb \
node-red-contrib-play \
node-red-contrib-say \
node-red-contrib-slack \
node-red-node-feedparser \
node-red-node-xmpp

COPY setup/ /
36 changes: 0 additions & 36 deletions Dockerfile.template

This file was deleted.

81 changes: 10 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,25 @@
# coffee-bin

> Holds flows for raspberry coffee waste counter with NodeRED.
> Holds flows for raspberry coffee bin counter with NodeRED.
[![NSP Status](https://nodesecurity.io/orgs/programmerq/projects/adb455c0-39c6-45b8-ad2c-8831d66dc366/badge)](https://nodesecurity.io/orgs/programmerq/projects/adb455c0-39c6-45b8-ad2c-8831d66dc366)

## Installation
### Local development

1. Fresh raspian package from [raspberrypi.org](https://www.raspberrypi.org/downloads/raspbian/)
2. Extract the _img_ file and copy to a SD-card with ``sudo dd bs=4M if=Downloads/2016-11-25-raspbian-jessie-lite.img of=/dev/mmcblk0``
3. Connect your device with a HDMI cable to a monitor and start the configuration process with ``raspi-config``
1. Expand disk space!
2. Enable SSH!
3. Change your password!
4. Change _hostname_ to _coffee_!
4. Look for the IP in network and connect with ``ssh pi@192.168.X.X`` The password is _raspberry_
5. Install NodeRED ``sudo apt-get update &&
sudo apt-get install nodered``
6. Start NodeRED on startup ``sudo systemctl enable nodered.service``
7. Update node ``sudo npm cache clean -f && sudo npm install -g n && sudo n stable``
8. Install additional nodes
````
sudo apt-get install npm
sudo npm install -g npm@2.x
hash -r
cd ~/.node-red
npm i node-red-node-pibrella node-red-node-xmpp node-red-node-feedparser
````
1. Create an docker network ``docker network create webproxy``
2. Rename the docker-compose file ``cp docker-compose.development.yml docker-compose-override.yml``
3. Start the application ``docker-compose up -d``

### Docker
## Server

1. Create an account on resin.io
2. Create an application on resin.io
3. Copy and add the respository path
4. Push it to resin.io ``git push resin master``
1. Start your httpd proxy
2. Start the application ``docker-compose up -d``

## Setup

### Wifi

1. Configure the Wifi connection ``sudo nano /etc/wpa_supplicant/wpa_supplicant.conf``
2. Edit _wpa_supplicant.conf_
```
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="xxx"
psk="xxx"
}
```
3. Restart adapter ``sudo ifdown wlan0 && ifup wlan0``
4. Check IP address ``ifconfig wlan0`` it should be look like this
```
wlan0 Link encap:Ethernet HWaddr 14:cc:20:22:ee:21
inet addr:192.168.178.32 Bcast:192.168.178.255 Mask:255.255.255.0
inet6 addr: fe80::7633:6243:492e:6985/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10 errors:0 dropped:532 overruns:0 frame:0
TX packets:30 errors:0 dropped:1 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2428 (2.3 KiB) TX bytes:5618 (5.4 KiB)
```

## Optional

## Usage
### Deployment with git

If you wanna use git to save your flows, you have to install _git_ and create a _key_

1. ``sudo apt update && apt install git-core``
Expand All @@ -76,12 +30,6 @@ If you wanna use git to save your flows, you have to install _git_ and create a
- ``git config --global user.email sammy@example.com``
4. ``git clone YOUR-REPO.git ~/flows``

### resin.io
#### Synching with resin.io

1. Install dependencies ``sudo npm i resin-cli js-yaml -g``
2. Start sync task ``resin sync --source . --destination /usr/src/app``

#### Environment variables

1. Authentification
Expand All @@ -94,12 +42,3 @@ If you wanna use git to save your flows, you have to install _git_ and create a
3. Monitoring
- PM2_SECRET_KEY
- PM2_PUBLIC_KEY

## Directories

1. Nodes ``/data/node-red-nodes/``
2. Flows ``/data/node-red/``
3. Backups ``/data/backup/``
4. Scripts ``/app/app/scripts/``
5. SSH ``/data/ssh``
6. Repository ``/data/coffee-bin``
35 changes: 0 additions & 35 deletions app/app.sh

This file was deleted.

46 changes: 0 additions & 46 deletions app/lib/console.sh

This file was deleted.

23 changes: 0 additions & 23 deletions app/lib/json.sh

This file was deleted.

0 comments on commit a3e63f2

Please sign in to comment.