Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ikenox committed Oct 8, 2018
1 parent 386e82b commit 06da8da
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 29 deletions.
81 changes: 52 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,62 @@
# Commenting Service on GAE

An commenting API service using Google App Engine and some Google Cloud Platform Services
An commenting API service based on Clean Architecture and Domain Driven Design

## About this project

This project aims to learn about followings.
This project is built in order to learn about followings.
- Clean Architecture
- Domain Driven Design
- MicroServices Architecture (just a little)

This project keeps these principles as much as possible.
So there are several parts which is over-engineered.
So this project has some over-engineered parts.

## Application Architecture Overview

## Domain Driven Design
![](doc/architecture-overview.png)

### Bounded contexts in Commenting Service
- This service has 3 bounded contexts.
- Commenting context
- Auth context
- Notification context
- Commenting API is based on Clean Architecture.

#### Commenting domain (core domain)
## Domain Driven Design in this project

### Bounded contexts

#### Commenting context (core domain)

Post a comment, delete a comment and view posted comments.

#### Notification domain (generic sub domain)
#### Notification context (generic sub domain)

Notify about some events to users or administrators.
In this project Google Cloud Pub/Sub are used for publishing/subscribing domain event.
This domain subscribes domain events and then notifies to appropriate persons.

#### Auth domain (generic sub domain)
#### Auth context (generic sub domain)

This domain helps user authentication.
In this project Firebase Authentication Service has auth domain role.

## A benefits of Clean Architecture
## Clean Architecture in Commenting API

### Architecture overview

To be written

### Benefits of Clean Architecture

Because of Clean Architecture, application logic and domain logic are independent with detail of infrastructure.
Followings are not appeared in the core of the application.

- Various packages which is related to Google App Engine
- Technological details of web application (e.g. context.Context)

# Setup

## Requirements

- go 1.8
Expand All @@ -49,12 +65,14 @@ Followings are not appeared in the core of the application.
- dev_appserver.py
- dep

## Setup
## Setup for local development

```shell
# /path/to/comment-api-on-gae/src/commenting
$ GOPATH=/path/to/comment-api-on-gae dep ensure
```
- Rewrite yaml for your environment
- Resolve dependencies
```shell
# /path/to/comment-api-on-gae/src/commenting
$ GOPATH=/path/to/comment-api-on-gae dep ensure
```

## Run

Expand All @@ -63,35 +81,40 @@ $ GOPATH=/path/to/comment-api-on-gae dep ensure
$ GOPATH=/path/to/comment-api-on-gae dev_appserver.py app --enable_watching_go_path --log_level=debug --datastore_path=.storage
```


## Test

todo

## Deploy

```shell
# /path/to/comment-api-on-gae/src/commenting
$ GOPATH=/path/to/comment-api-on-gae goapp deploy app
```

## Setup cloud services
## Setup Cloud Services

### Google App Engine

- Create datastore index
- issue service account which have following privileges
- firebase data manager
- pubsub publisher/subscriber
- add authorized mail sender on appengine console
- rewrite yaml
- Issue service account which have following privileges
- Firebase data manager
- Pubsub editor
- Add authorized mail sender on Google App Engine console

### Firebase

- enable anonymous login
- Enable anonymous login

### Google cloud pubsub

- create topic

gcloud beta pubsub topics create domain-event
gcloud beta pubsub subscriptions create comment-api-domain-event \
--topic domain-event \
--push-endpoint \
https://YOUR_PROJECT_ID.appspot.com/_ah/push-handlers/domain-event \
--ack-deadline 10
- Create topic `domain-event`
```
gcloud beta pubsub topics create domain-event
gcloud beta pubsub subscriptions create comment-api-domain-event \
--topic domain-event \
--push-endpoint \
https://YOUR_PROJECT_ID.appspot.com/_ah/push-handlers/domain-event \
--ack-deadline 10
```
Binary file added doc/architecture-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 06da8da

Please sign in to comment.