Skip to content
This repository has been archived by the owner on Feb 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #35 from notfoundsam/develop
Browse files Browse the repository at this point in the history
v0.3-dev
  • Loading branch information
notfoundsam authored Jul 6, 2019
2 parents d8ac245 + 774f702 commit fcbd172
Show file tree
Hide file tree
Showing 113 changed files with 4,402 additions and 36,183 deletions.
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# temp files from editors
*~
*.bak
Expand All @@ -16,8 +21,6 @@ nbproject/
/node_modules/

# application
/db_repository/
app.db
ir_tmp_code.txt

# node-red
Expand All @@ -26,6 +29,4 @@ node-red/*
!node-red/Dockerfile_rpi
!node-red/smart_remote.json

# Docker files
/docker/*
!/docker/.*
*.log
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
FROM python:2
FROM python:3

ENV TZ=Asia/Tokyo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN mkdir /app
WORKDIR /app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# RUN pip3 install -U pip
# RUN pip install -U setuptools
# RUN pip install -U wheel

RUN pip install --upgrade pip
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -r requirements.txt
23 changes: 0 additions & 23 deletions Dockerfile_rpi

This file was deleted.

15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ALL: up-dev
build-dev:
docker-compose -f docker-compose.yml build
build-server:
docker-compose -f docker-compose-server.yml build
up-dev:
docker-compose -f docker-compose.yml up -d
up-server:
docker-compose -f docker-compose-server.yml up -d
stop:
docker-compose stop
migrate:
docker-compose exec web flask db upgrade
rollback:
docker-compose exec web flask db downgrade
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ $ git clone https://github.com/notfoundsam/smart-remote.git
$ cd smart-remote
```

Install python requirements
## Run services on local machine by docker or create each service by yourself (mysql, node-red, influxdb, grafana, mosquitto)
```bash
$ pip install --no-cache-dir -r requirements.txt
$ docker-compose -f docker-compose-server.yml up -d
```

Create Data Base
## Install python requirements
```bash
$ python db_create.py
$ pip install --no-cache-dir -r requirements.txt
```

Run the application
Expand All @@ -28,6 +28,17 @@ Check it
http://localhost:5000
```

## Flask create migration
```bash
$ flask db migrate --rev-id 001
```

## Flask migrate db
```bash
$ flask db upgrade
$ flask db downgrade
```

## Run development mode on docker

```bash
Expand All @@ -38,3 +49,19 @@ $ docker-compose up
```bash
$ docker stack deploy --compose-file docker-compose-swarm.yml smart-home
```

<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">

### node red as volume in ubuntu, set chmod 777 to mounted folder

### pip update packages
`pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U`

### generate requirements
pip freeze > requirements.txt
Loading

0 comments on commit fcbd172

Please sign in to comment.