Skip to content

Commit

Permalink
chore: Use docker-compose to run quickstart (#632)
Browse files Browse the repository at this point in the history
* remove init func

Signed-off-by: seeflood <[email protected]>

* add docker compose

Signed-off-by: seeflood <[email protected]>

* modify quickstart to use docker compose

Signed-off-by: seeflood <[email protected]>

* modify english quickstart to use docker compose

Signed-off-by: seeflood <[email protected]>

* improve Document Contribution Guide

Signed-off-by: seeflood <[email protected]>

* fix typo

Signed-off-by: seeflood <[email protected]>

* fix start/pubsub/start

Signed-off-by: seeflood <[email protected]>

* fix quickstart

Signed-off-by: seeflood <[email protected]>

* improve operation doc

Signed-off-by: seeflood <[email protected]>
  • Loading branch information
seeflood authored Jun 8, 2022
1 parent c9081af commit 309ed3a
Show file tree
Hide file tree
Showing 19 changed files with 589 additions and 127 deletions.
139 changes: 139 additions & 0 deletions configs/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"servers": [
{
"default_log_path": "stdout",
"default_log_level": "DEBUG",
"routers": [
{
"router_config_name": "actuator_dont_need_router"
}
],
"listeners": [
{
"name": "grpc",
"address": "0.0.0.0:34904",
"bind_port": true,
"filter_chains": [
{
"filters": [
{
"type": "grpc",
"config": {
"server_name": "runtime",
"grpc_config": {
"hellos": {
"quick_start_demo": {
"type": "helloworld",
"hello": "greeting"
}
},
"state": {
"state_demo": {
"type": "in-memory",
"metadata": {
}
}
},
"lock": {
"lock_demo": {
"type": "in-memory",
"metadata": {
}
}
},
"pub_subs": {
"pub_subs_demo": {
"type": "in-memory",
"metadata": {
"consumerID": "1"
}
}
},
"sequencer": {
"sequencer_demo": {
"type": "in-memory",
"metadata": {}
}
},
"secret_store": {
"secret_demo": {
"type": "local.env",
"metadata": {
}
}
},
"bindings": {
"bindings_demo": {
"type": "http",
"metadata": {
"url": "https://mosn.io/layotto"
}
}
},
"custom_component": {
"helloworld": {
"demo": {
"type": "in-memory",
"metadata": {}
}
}
},
"app": {
"app_id": "app1",
"grpc_callback_port": 9999
}
}
}
}
]
}
]
},
{
"name": "actuator",
"address": "127.0.0.1:34999",
"bind_port": true,
"filter_chains": [
{
"filters": [
{
"type": "proxy",
"config": {
"downstream_protocol": "Http1",
"upstream_protocol": "Http1",
"router_config_name": "actuator_dont_need_router"
}
}
]
}
],
"stream_filters": [
{
"type": "actuator_filter"
}
]
}
]
}
],
"tracing": {
"enable": true,
"driver": "SOFATracer",
"config": {
"generator": "mosntracing",
"exporter": [
"stdout"
]
}
},
"metrics": {
"sinks": [
{
"type": "prometheus",
"config": {
"port": 34903
}
}
]
}
}
6 changes: 0 additions & 6 deletions diagnostics/jaeger/grpc_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ import (
"github.com/uber/jaeger-client-go/config"
"mosn.io/api"
"mosn.io/mosn/pkg/log"
"mosn.io/mosn/pkg/trace"
"mosn.io/mosn/pkg/trace/jaeger"
"mosn.io/mosn/pkg/types"

ltrace "mosn.io/layotto/components/trace"
"mosn.io/layotto/diagnostics/grpc"
"mosn.io/layotto/diagnostics/protocol"
)

const (
Expand Down Expand Up @@ -63,10 +61,6 @@ type grpcJaegerSpan struct {
spanCtx jaegerc.SpanContext
}

func init() {
trace.RegisterTracerBuilder(jaeger.DriverName, protocol.Layotto, NewGrpcJaegerTracer)
}

func NewGrpcJaegerTracer(traceCfg map[string]interface{}) (api.Tracer, error) {
// 1. construct the ReporterConfig, which is used to communicate with jaeger
var reporter *config.ReporterConfig
Expand Down
6 changes: 0 additions & 6 deletions diagnostics/skywalking/grpc_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,12 @@ import (
language_agent "github.com/SkyAPM/go2sky/reporter/grpc/language-agent"
"mosn.io/api"
"mosn.io/mosn/pkg/log"
"mosn.io/mosn/pkg/trace"
"mosn.io/mosn/pkg/trace/skywalking"
"mosn.io/mosn/pkg/types"

ltrace "mosn.io/layotto/components/trace"
"mosn.io/layotto/diagnostics/protocol"
)

func init() {
trace.RegisterTracerBuilder(skywalking.SkyDriverName, protocol.Layotto, NewGrpcSkyTracer)
}

func NewGrpcSkyTracer(_ map[string]interface{}) (api.Tracer, error) {
return &grpcSkyTracer{}, nil
}
Expand Down
104 changes: 104 additions & 0 deletions docker/layotto-redis/config_redis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"servers": [
{
"default_log_path": "stdout",
"default_log_level": "DEBUG",
"routers": [
{
"router_config_name": "actuator_dont_need_router"
}
],
"listeners": [
{
"name": "grpc",
"address": "0.0.0.0:34904",
"bind_port": true,
"filter_chains": [
{
"filters": [
{
"type": "grpc",
"config": {
"server_name": "runtime",
"grpc_config": {
"hellos": {
"quick_start_demo": {
"type": "helloworld",
"hello": "greeting"
}
},
"state": {
"state_demo": {
"type": "redis",
"metadata": {
"redisHost": "redis:6379",
"redisPassword": ""
}
}
},
"sequencer": {
"sequencer_demo": {
"type": "redis",
"metadata": {
"redisHost": "redis:6379",
"redisPassword": ""
}
}
},
"lock": {
"lock_demo": {
"type": "redis",
"metadata": {
"redisHost": "redis:6379",
"redisPassword": ""
}
}
},
"pub_subs": {
"pub_subs_demo": {
"type": "redis",
"metadata": {
"redisHost": "redis:6379",
"redisPassword": ""
}
}
},
"app": {
"app_id": "app1",
"grpc_callback_port": 9999
}
}
}
}
]
}
]
},
{
"name": "actuator",
"address": "0.0.0.0:34999",
"bind_port": true,
"filter_chains": [
{
"filters": [
{
"type": "proxy",
"config": {
"downstream_protocol": "Http1",
"upstream_protocol": "Http1",
"router_config_name": "actuator_dont_need_router"
}
}
]
}
],
"stream_filters": [
{
"type": "actuator_filter"
}
]
}
]
}
]
}
35 changes: 35 additions & 0 deletions docker/layotto-redis/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#Licensed to the Apache Software Foundation (ASF) under one or more
#contributor license agreements. See the NOTICE file distributed with
#this work for additional information regarding copyright ownership.
#The ASF licenses this file to You under the Apache License, Version 2.0
#(the "License"); you may not use this file except in compliance with
#the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.

version: '3.3'
services:
layotto:
image: layotto/layotto:latest
container_name: layotto
command:
- 'start'
volumes:
- ./config_redis.json:/runtime/configs/config.json
ports:
- 34903:34903
- 34904:34904
- 34999:34999
depends_on:
- redis

redis:
image: "redis:latest"
ports:
- 6379:6379
2 changes: 1 addition & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- [Home](/en/README.md)
- Quick start
- [Use State API](en/start/state/start.md)
- Use Configuration API
- [Use Apollo as configuration center](en/start/configuration/start-apollo.md)
- [Use Etcd as configuration center](en/start/configuration/start.md)
- [Use State API](en/start/state/start.md)
- [Use Pub/Sub API](en/start/pubsub/start.md)
- [Use Distributed Lock API](en/start/lock/start.md)
- [Use Sequencer API](en/start/sequencer/start.md)
Expand Down
25 changes: 14 additions & 11 deletions docs/en/development/contributing-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,34 @@ Thank you for your support in Layotto!

This document describes how to modify/add documents. Documentation for this repository is written in Markdown.

## Document Path description
## 1. Document Path description

Documents are stored in the 'docs/' directory, where 'docs/en' stores English documents and 'docs/zh' stores Chinese documents.

![img_2.png](../../img/development/doc/img_2.png)

## How to Add a New Document
## 2. Documentation Site Description
Files under docs/ directory will be automatically deployed to github pages and rendered through [docsify](https://docsify.js.org/#/).

Generally speaking, after the .md file is merged into the main branch, you can see the new page on the Layotto's documentation site, and all deployment and rendering processes are done automatically.

## 3. How to Add a New Document
### step 1. Write a new markdown file
To add a document, create a folder and a .md file based on the directory structure. For example, if you want to write a design document for the distributed lock API, just create a new directory:

![img_1.png](../../img/development/doc/img_1.png)

2. Remember to update the sidebar after adding new documents or revising existing documents.
### step 2. Update the sidebar
Remember to update the sidebar after adding new documents or revising existing documents.

Chinese sidebar: 'docs/zh/_sidebar.md'

English sidebar: 'docs/_sidebar.md'

3. After writing the above Markdown files, submitting pr and merging it into the main branch, new documents are now available on the official website.

## Documentation Site Description
Files under docs/ directory will be automatically deployed to github pages and rendered through [docsify](https://docsify.js.org/#/).

Generally speaking, after the .md file is merged into the main branch, you can see the new page on the Layotto's documentation site, and all deployment and rendering processes are done automatically.
### step 3. Submit a Pull request
After writing the above Markdown files, submitting pr and merging it into the main branch, new documents are now available on the official website.

## Common Pitfalls: Hyperlinks Within Documents
## 4. Tips on Hyperlinks

One annoying problem with Docsify is that the use of hyperlinks are confusing.

Expand Down Expand Up @@ -57,7 +60,7 @@ b. Use the full Url. Such as:
see [runtime_config.json](https://github.com/mosn/layotto/blob/main/configs/runtime_config.json):
```

## Picture Catalog and Link
## 5. Tips on image links
Images are stored under docs/img/ directory for the purpose that the Docsify site can access it

![img.png](../../img/development/doc/img.png)
Expand Down
Loading

0 comments on commit 309ed3a

Please sign in to comment.