Skip to content

Commit

Permalink
Fixed typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans committed May 7, 2020
1 parent 6fd3b12 commit 4a2423e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
ADDON_NAME=$( cut -c21- <<< ${{ github.repository }} )
ADDON_VERSION=$( cut -c12- <<< ${{ github.ref }} )
mkdir -p repository/timescaledb
cp -v addon/README.md addon/timescaledb/config.json addon/timescaledb/8.png repository/timescaledb
cp -v addon/README.md addon/timescaledb/config.json addon/timescaledb/*.png repository/timescaledb
cd repository
sed -i "s/dev/$ADDON_VERSION/g" timescaledb/config.json
sed -i "s/imageaftercd/image/g" timescaledb/config.json
Expand Down
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# HomeAssistant Add-On: [TimescaleDB](https://www.timescale.com/)
# Home Assistant Add-on: [TimescaleDB](https://www.timescale.com/)
## [PostgreSql](https://www.postgresql.org/) & [Postgis](https://postgis.net/) & [TimescaleDB](https://www.timescale.com/)

## TimescaleDB Overview

From: https://docs.timescale.com/latest/introduction

TimescaleDB is an open-source time-series database optimized for fast ingest and complex queries. It speaks "full SQL" and is correspondingly easy to use like a traditional relational database, yet scales in ways previously reserved for NoSQL databases.

Compared to the trade-offs demanded by these two alternatives (relational vs. NoSQL), TimescaleDB offers the best of both worlds for time-series data:

### Easy to Use
Full SQL interface for all SQL natively supported by PostgreSQL (including secondary indexes, non-time based aggregates, sub-queries, JOINs, window functions).

- Connects to any client or tool that speaks PostgreSQL, no changes needed.
- Time-oriented features, API functions, and optimizations.
- Robust support for Data retention policies.



## Introduction

Say, you want put all those nice Home Assistant measurements from your smarthome to good use, and for example, use something like [Grafana](https://grafana.com) for your dashboards, and maybe [Prometheus](https://prometheus.io/) for monitoring..
Expand Down Expand Up @@ -87,7 +104,7 @@ Or leave empty for accepting auto-tune.

See also:
https://docs.timescale.com/latest/getting-started/configuring
for further tuning. Your Postgres.config file it located in the addon's data directory.
for further tuning. Your Postgres.config file is located in the addon's data directory.

## Usage

Expand All @@ -107,7 +124,7 @@ Make sure you change this immediately after activating the add-on:
ALTER USER user_name WITH PASSWORD 'strongpassword';
```

A default `pg_hba.conf` is created in the data directory with the following content, which allows local peer usrs and network users with passwords.:
A default `pg_hba.conf` is created in the data directory with the following content, which allows local peer users and network users with passwords.:

```
# TYPE DATABASE USER ADDRESS METHOD
Expand Down
16 changes: 8 additions & 8 deletions timescaledb/rootfs/etc/services.d/postgres/run
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ bashio::log.info "done"

# Wait for postgres to become availale..
sleep 3
#while ! mysql -e "" 2> /dev/null; do
# psql -U "postgres" postgres -c "SELECT 1;"
#while ! psql -U "postgres" postgres -c "SELECT 1;" 2> /dev/null; do
# sleep 1
#done

# Create extensions timescaledb in initial databases
psql -U "postgres" postgres -c "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"
psql -U "postgres" template1 -c "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"
if bashio::var.true "${new_install}"; then
psql -U "postgres" postgres -c "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"
psql -U "postgres" template1 -c "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"
fi

# Create all databases if not exist
bashio::log.info "Ensure databases exists.."
for database in $(bashio::config "databases"); do
bashio::log.info "Create database '${database}'"
bashio::log.info "Create database if not exist: '${database}'"
psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = '${database}'" | grep -q 1 || psql -U postgres -c "CREATE DATABASE ${database}"
done
bashio::log.info "done"

# Enable the timescale-extentions for all indicated databases
bashio::log.info "Enabling Timescale Extensions.."
for database in $(bashio::config "timescale_enabled"); do
bashio::log.info "Enabling Timescale Extension for database '${database}'"
bashio::log.info "Enabling Timescale Extension for database: '${database}'"
psql -U "postgres" ${database} -c "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"
done
bashio::log.info "done"
Expand Down

0 comments on commit 4a2423e

Please sign in to comment.