Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
fix #71: review init script for database
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Nov 23, 2018
1 parent 50c2619 commit 42ed6e7
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ brew:
commit_author:
name: Kamil Samigullin
email: kamil@samigullin.info
description: Access Control as a Service
description: Paywall as a Service
folder: Formula
github:
name: homebrew-tap
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
> # 💂‍♂️ Guard [![Tweet][icon_twitter]][twitter_publish] <img align="right" width="126" src=".github/character.png">
> [![Analytics][analytics_pixel]][page_promo]
> Access Control as a Service &mdash; your personal paywall to protect any API or site's content.
> Paywall as a Service &mdash; your personal guard to restrict access to content via a paid subscription.
[![Patreon][icon_patreon]](https://www.patreon.com/octolab)
[![Build Status][icon_build]][page_build]
Expand All @@ -12,7 +12,7 @@
- [**October 20, 2018**][project_v1_dl]
- Main concepts and working prototype.
- [ ] v2: [Rate limiting][project_v2]
- [**December 16, 2018**][project_v2_dl]
- [**Someday, 20xx**][project_v2_dl]
- Request rate limiting and metrics related to license checking.

## Motivation
Expand All @@ -39,11 +39,15 @@ guard_server_1 nginx -g daemon off; Up 0.0.0.0:443->443/tcp,
guard_service_1 service run --with-profili ... Up 8080/tcp, 8090/tcp, 8091/tcp, 8092/tcp, 8093/tcp
guard_spec_1 sh /usr/share/nginx/docker ... Up 80/tcp, 8080/tcp

$ make install

$ ./env/client/rpc/install.sh localhost:443

$ open http://spec.127.0.0.1.xip.io/

$ make help

$ make demo destroy
```

## Specification
Expand Down
2 changes: 1 addition & 1 deletion env/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ READ_HEADER_TIMEOUT=0
WRITE_TIMEOUT=0
IDLE_TIMEOUT=0

DB_DSN=postgres://postgres:postgres@db:5432/postgres?connect_timeout=1&sslmode=disable
DB_DSN=postgres://guard:guard@db:5432/guard?connect_timeout=1&sslmode=disable
DB_OPEN_CONN=1
DB_IDLE_CONN=1
DB_CONN_MAX_LT=0
Expand Down
2 changes: 1 addition & 1 deletion env/api/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "protoc-gen-swagger/options/annotations.proto";

option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
info: {
title: "Access Control as a Service";
title: "Paywall as a Service";
version: "dev";
contact: {
name: "Guard project of Hugs Platform";
Expand Down
2 changes: 1 addition & 1 deletion env/api/swagger.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"swagger": "2.0",
"info": {
"title": "Access Control as a Service",
"title": "Paywall as a Service",
"version": "dev",
"contact": {
"name": "Guard project of Hugs Platform",
Expand Down
2 changes: 2 additions & 0 deletions env/docker/compose/docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
# context: ../db/context
# dockerfile: ../Dockerfile
env_file: ../db/.env
volumes:
- ../db/context/initdb.d:/docker-entrypoint-initdb.d

legacy:
image: php:fpm-alpine
Expand Down
2 changes: 2 additions & 0 deletions env/docker/db/context/initdb.d/guard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE USER "guard" WITH PASSWORD 'guard';
CREATE DATABASE "guard";
GRANT ALL PRIVILEGES ON DATABASE "guard" TO "guard";
\c "guard";
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
EOSQL
2 changes: 1 addition & 1 deletion env/docker/service/.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ READ_HEADER_TIMEOUT=0
WRITE_TIMEOUT=0
IDLE_TIMEOUT=0

DB_DSN=postgres://postgres:postgres@db:5432/postgres?connect_timeout=1&sslmode=disable
DB_DSN=postgres://guard:guard@db:5432/guard?connect_timeout=1&sslmode=disable
DB_OPEN_CONN=1
DB_IDLE_CONN=1
DB_CONN_MAX_LT=0
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
"read_header_timeout": time.Duration(0),
"write_timeout": time.Duration(0),
"idle_timeout": time.Duration(0),
"dsn": "postgres://postgres:postgres@127.0.0.1:5432/postgres?connect_timeout=1&sslmode=disable",
"dsn": "postgres://guard:guard@127.0.0.1:5432/guard?connect_timeout=1&sslmode=disable",
"open_conn": runtime.GOMAXPROCS(0),
"idle_conn": runtime.GOMAXPROCS(0),
"conn_max_lt": 0,
Expand Down

0 comments on commit 42ed6e7

Please sign in to comment.