Skip to content

sergripenko/media_service

Repository files navigation

media_service

1: Prepare project env

Create app database:

Install PostgreSQL:

sudo apt-get update

sudo apt-get install postgresql

Or follow the installation instructions for PostgreSQL from the official website:

https://www.postgresql.org/download

Check installation:

sudo -u postgres psql
CREATE DATABASE media_service;

Or exit from postgres command line and create db with linux command:

\q

sudo -u postgres createdb media_service

Enter to the database:

sudo -u postgres psql -d media_service

Create user of the db from postgres command line:

CREATE USER admin WITH PASSWORD '123';

\q

Go to the postgres command line and do some customization:

sudo -u postgres psql

ALTER ROLE admin SET client_encoding TO 'utf8';

ALTER ROLE admin SET default_transaction_isolation TO 'read committed';

ALTER ROLE admin SET timezone TO 'UTC';

GRANT ALL PRIVILEGES ON DATABASE media_service TO admin;

ALTER USER admin CREATEDB;

\q

2: Getting Started

Inside media_service/db directory create "dbconf.yml" file with such content:

development:
    driver: postgres
    open: user=admin dbname=media_service password=123 host=127.0.0.1 port=5432 sslmode=disable

Install Goose migration tool:

https://bitbucket.org/liamstask/goose/src/master/

go get bitbucket.org/liamstask/goose/cmd/goose

Inside the project root directory migrate the database:

goose up

To delete tables, repeat below command for each table:

goose down

To install all dependencies run:

dep ensure -v

To run app:

bee run -downdoc=true -gendoc=true

Swagger docs:

http://127.0.0.1:8080/swagger/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published