No description
Find a file
2019-11-13 16:50:57 +01:00
amqp #26 complete implementation of healthz endpoint and testing 2019-11-13 09:43:37 +01:00
database Merge branch 'master' of git.rwth-aachen.de:acs/public/villas/villasweb-backend-go 2019-11-12 12:02:51 +01:00
doc improves swaggo documentation 2019-11-13 15:03:31 +01:00
helper Revision of (file) testing 2019-09-11 12:30:01 +02:00
routes Improvements for swagger API documentation 2019-11-13 14:48:08 +01:00
.gitignore Added .gitignore 2019-04-02 14:51:32 +02:00
.gitlab-ci.yml swaggo: fix base url for API 2019-11-13 16:50:57 +01:00
COPYING.md Initial commit 2019-03-03 15:40:38 +01:00
curl_villasAPI.sh Added the bash curl script for API testing 2019-08-28 13:27:24 +02:00
Dockerfile docker: fix build 2019-11-09 11:58:13 +01:00
go.mod fix repo path 2019-11-09 11:40:56 +01:00
go.sum add "Active" bool property to user model, required modifications in user and scenario packages 2019-09-17 17:00:07 +02:00
README.md Update for Readme file 2019-11-13 15:51:05 +01:00
start.go swaggo: fix base url for API 2019-11-13 16:50:57 +01:00

VILLASweb-backend-go

pipeline status coverage report

Description

This is a rewrite of the backend for the VILLASweb website in Go. It is based upon gin-gonic and GORM frameworks.

Usage

Requirements

  • Go (version 1.11 or higher)
  • PostgreSQL database (tested for version 11, instructions see below)
  • swag (https://github.com/swaggo/swag) for automated API documentation creation

Compiling

$ go mod tidy
$ go build

Testing

$ go mod tidy
$ go test $(go list ./... ) -p 1

Running

go run start.go [params]

Parameters

You can type

go run start.go --help

to get a list of available parameters and default values

PostgreSQL Database

Before running the application the user has to setup and configure PostgreSQL.

To create a new database login to user postgres and start psql

$ su - postgres
$ psql

then

CREATE DATABASE villasdb ;

Some usefull commants for psql

\c somedb -- connect to a database 
\dt       -- list all tables of the database
\l        -- list all databases

The default host for postgres is \tmp and the ssl mode is disabled in development. The user can change those setting in common/database.go.

To manage the database one can use pgAdmin4. Instructions for rpm-based distributions can be found here. The user might have to start pgAdmin as root

$ sudo pythonX /user/lib/pythonX.Y/site-packages/pgadmin4-web/pgAdmin4.py

where X.Y is the python version. The pgAdmin UI can be accessed by the browser at 127.0.0.1:5050. In case that the user is getting FATAL: Ident authentication failed for user "username" the authentication for local users has to be changed from ident to trust in pg_hba.conf file

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

To do that edit the configuration file as root

$ sudo vim /var/lib/pgsql/11/data/pg_hba.conf

2019, Institute for Automation of Complex Power Systems, EONERC

License

This project is released under the terms of the GPL version 3.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

For other licensing options please consult Prof. Antonello Monti.

Contact

EONERC ACS Logo

Institute for Automation of Complex Power Systems (ACS)
EON Energy Research Center (EONERC)
RWTH University Aachen, Germany