• Stars
    star
    136
  • Rank 267,670 (Top 6 %)
  • Language
    JavaScript
  • License
    BSD 3-Clause "New...
  • Created almost 12 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Amateur weather graphs using d3 js, watch js, rivets js, lua, postgresql, nginx

AmatYr

AmatYr is a personal weather station display software project.

The software is a modern HTML5 "single page app" using JavaScript to fetch data from SQL via JSON from Postgresql + Lua backend. Then the data is transformed into pretty visualizations by the brilliant (D3.js)[http://d3js.org] library, giving the data life!

Primary goal of the project is bringing modern and responsive design, suitable for desktop, tablet and mobile-sized screens. A secondary goal is just playing with new technology because it's fun :-) And I guess a goal is to display some pretty graphs and such for local weather!

Frontend Components

Backend Components

  • Openresty (nginx + luajit)
  • PostgreSQL

Getting weather data into SQL

The frontend is somewhat loosely coupled with the backend, but it fetches data via JSON from the backend, so to get data displayed it must be accessible in that manner. There's 3 different ways to achieve that. Use one of these methods:

  • Included with the project is a small python utility to read Davis Vantage .txt-logs and insert into SQL (davislogparser.py)
  • Inlucded with the project is a smal python utility to read the output from Weather Display Live and insert into SQL (wdparser.py)
  • Included is a patch (scripts/weewx-2.1.1.postgresql.patch) for (Weewx)[http://weewx.com] to be able to store data in PostgreSQL.

Installation of the frontend

  1. Clone this repostory
  2. Add bootstrap resources
  3. Add fontawesome resources
  4. Compile and install openresty, with LuaJit and Postgresql support. Grab source at Openresty

Run:

./configure --with-luajit  --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-http_postgres_module

And follow Openresty's own installation docs.

  1. Configure postgresql

  2. Configure the virtual host for nginx like this:

    lua_package_path '/home/yr/amatyr/?.lua;;';

    server { listen *:80; server_name yr.no;

     set $root /home/yr/amatyr/;
     root   $root;
     access_log /home/yr/amatyr/access.log;
     error_log /home/yr/amatyr/error.log;
    
     location /api {
        lua_code_cache off;
        content_by_lua_file $root/pgrouter.lua;
     }
     location /static {
         root $root;
     }
    
     location / { try_files $uri @lua; }
     location @lua {
        lua_code_cache off;
        content_by_lua_file $root/amatyr.lua;
     }
    

    }

  3. Install the resty postgresql driver from https://github.com/azurewang/lua-resty-postgres One simple way to do this is put the postgres.lua in the default openresty folder:

    wget -O /usr/local/openresty/lualib/resty/postgres.lua https://github.com/azurewang/lua-resty-postgres/raw/master/lib/resty/postgres.lua

Live demo

My personal installation of this project is running at http://yr.hveem.no It has a blog post to go with the setup at http://hveem.no/raspberry-pi-davis-vue-weather-station-with-custom-frontend

License

AmatYr uses a BSD 3-clause license.

Copyright (c) 2013, Tor Hveem or Project Contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.

* Neither the name of the AmatYr Project, Tor Hveem, nor the names
  of its contributors may be used to endorse or promote products
  derived from this software without specific prior written
  permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

More Repositories

1

weechat-matrix-protocol-script

A WeeChat script in Lua that implements the matrix.org chat protocol
Lua
352
star
2

LuaWeb

A very simple blog engine using openresty, nginx, lua, markdown, git and redis
Lua
170
star
3

openresty-docker

Dockerfile and sample settings for Openresty/Lua development using Docker
Nginx
87
star
4

infping

Parse fping output, store result in influxdb 0.9
Go
65
star
5

lua-resty-letsencrypt

Lua script for Nginx to automatically get certificates from LetsEncrypt CA
Lua
65
star
6

pix

Photo gallery built with Lapis/Moonscript/Lua/PostgreSQL/Redis/Openresty/HTML5/Angular
JavaScript
38
star
7

blag

My blog articles
22
star
8

photongx

A photo gallery with next to no chrome, written in lua deploying with nginx
JavaScript
20
star
9

lapis-docker

Dockerfile for lapis
Shell
15
star
10

saltvirtweb

A simple virt mgmt admin web interface for salt and salt API
12
star
11

states

My salt states
Shell
12
star
12

cubesensor

My own frontend and API for cubesensors
JavaScript
9
star
13

Weechat-scripts

Weechat scripts
Python
8
star
14

lapiswiki

A very simple wiki-like web editor built in Lapis/Moonscript with the WYSIWYG CKEditor
MoonScript
8
star
15

gomirc

Matrix <=> IRC bridge in Go
Go
8
star
16

salt-xmpp

A simple Salt XMPP gateway example
Python
8
star
17

saltibot

IRC bot listening to salt event bus and publishes filtered events and functions to IRC
Python
5
star
18

weechat-docker

Dockerfile for running development version of WeeChat
C
4
star
19

bash

Online Quote DataBase
MoonScript
4
star
20

Nyfyk

HTML5 RSS Reader app. SQLite3+newsbeuter+openresty-backend
Lua
3
star
21

lsurl

Super simple URL shortening service in Lua/MoonScript
MoonScript
2
star
22

ip

A simple web service in Openresty returning information about the HTTP request
HTML
1
star
23

weechat-urls

Flask web project to display URLs from weechat slite database, optimized for tablets
JavaScript
1
star
24

comics

Java
1
star
25

lurls

A link viewer for IRC bot
JavaScript
1
star