mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
Add instructions for Docker in Readme file
This commit is contained in:
parent
2120862925
commit
b3fa1cf785
1 changed files with 45 additions and 10 deletions
55
README.md
55
README.md
|
@ -1,25 +1,60 @@
|
||||||
# <img src="doc/pictures/villas_web.png" width=40 /> VILLASweb-backend-go
|
# <img src="doc/pictures/villas_web.png" width=40 /> VILLASweb-backend-go
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
This is a rewrite in Go language of the backend for the VILLASweb
|
This is a rewrite of the backend for the VILLASweb
|
||||||
website. The term __frontend__ refers to this project, the server the
|
website in Go.
|
||||||
website (frontend) is talking to. The backend serves the database
|
|
||||||
content to the website, handles authentication and persistent storage of
|
|
||||||
content. It does __not__ handle simulation data. For this have a look at
|
|
||||||
VILLASnode.
|
|
||||||
|
|
||||||
## Frameworks
|
## Frameworks
|
||||||
The backend is build upon [gin-gonic](https://github.com/gin-gonic/gin)
|
The backend is build upon [gin-gonic](https://github.com/gin-gonic/gin)
|
||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
### Database
|
### Docker
|
||||||
|
You can use the `Dockerfile.ubuntu` for development and testing.
|
||||||
|
To build an tag the image call the following in the top level of the repository:
|
||||||
|
|
||||||
**The current repo is tested on Fedora 29 and with PostgreSQL 11 and Go
|
```bash
|
||||||
1.11**
|
$ docker build -f Dockerfile.ubuntu -t villaswebbackendgo:ubuntu .
|
||||||
|
```
|
||||||
|
|
||||||
|
To run an interactive container based on the image call:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker run --rm -it villaswebbackendgo:ubuntu
|
||||||
|
```
|
||||||
|
|
||||||
|
By using the `--rm` option of docker, the container will be removed upon exit.
|
||||||
|
Omit this option if you want the container to persist on your system.
|
||||||
|
|
||||||
|
Within the container you need to start the PostgreSQL server by invoking the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ /etc/init.d/postgresql start
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you are ready to compile an test the code.
|
||||||
|
### Compiling
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go mod tidy
|
||||||
|
$ go build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
```bash
|
||||||
|
$ go mod tidy
|
||||||
|
$ cd common
|
||||||
|
$ go test -v -args -dbhost=/var/run/postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## PostgreSQL Database
|
||||||
|
|
||||||
|
**The current repo is tested for PostgreSQL 11 and Go 1.11**
|
||||||
|
|
||||||
Before running the application the user has to setup and configure
|
Before running the application the user has to setup and configure
|
||||||
[PostgreSQL](https://www.postgresql.org/) on the local machine.
|
[PostgreSQL](https://www.postgresql.org/).
|
||||||
|
Alternatively the provided Dockerfile can be used (see above).
|
||||||
|
|
||||||
To create a new database login to user `postgres` and start `psql`
|
To create a new database login to user `postgres` and start `psql`
|
||||||
```bash
|
```bash
|
||||||
|
|
Loading…
Add table
Reference in a new issue