Coder Social home page Coder Social logo

device-controller-app's Introduction

Industrial Training Course Server

Server side application to control devices through a network. Part of Aalto University ELEC-C7430 Industrial Training course.

Configure

Create a config.py in the instance folder:

$ mkdir instance
$ touch instance/config.py

In config.py:

ADMIN_PASS = "some-password"
SECRET_KEY = b'some-random-string'

here ADMIN_PASS is required for registering new users. SECRET_KEY is required by Flask application.

Deployment and maintenance (Docker or manually)

With Docker

With Docker, web application can keep working in the background and it will also automatically restart after a server reboot. Docker has more potential in terms of deployment automation but it was not fully used here.

Deployment

Create a docker volume to store a database file:

$ docker volume create indtrain-db

Build the image and run the container:

$ docker build -t indtrain .
$ docker run -d -p 5050:5050 --name indtrain --restart always -v indtrain-db:/tmp indtrain

Features

Stop or start the web application:

$ docker stop indtrain
$ docker start indtrain

Delete the build:

$ docker rm indtrain
$ docker rmi indtrain
$ docker volume rm indtrain-db

Reset the database:

$ docker rm indtrain
$ docker rmi indtrain
$ docker volume rm indtrain-db
$ docker volume create indtrain-db
$ docker run -d -p 5050:5050 --name indtrain --restart always -v indtrain-db:/tmp indtrain

Update the build (Database persists):

$ docker stop indtrain
$ docker rm indtrain
$ docker rmi indtrain
$ git pull
$ docker build -t indtrain .
$ docker run -d -p 5050:5050 --name indtrain --restart always -v indtrain-db:/tmp indtrain

Manually

Deployment

$ python3 -m venv venv
$ . venv/bin/activate
$ pip install waitress
$ pip install -r requirements.txt
$ waitress-serve --port=5050 --call flaskr:create_app

Features

Reset the database:

rm /tmp/flaskr.sqlite

Update the build (Database persists):

$ git pull

device-controller-app's People

Contributors

yerzham avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.