/gobel-example

Gobel is a headless cms built with golang.

Primary LanguageDockerfileMIT LicenseMIT

gobel-example

Gobel is a headless cms built with golang.

This repository contains the code to run gobel in each environment.

Both local environment and production environment are assumed to be operated with docker-compose.

gobel

Get started

Docker Compose

Work in ./docker-compose directory.

Create a network

make docker-create-network

Copy a and edit an .env

If you want to check the operation, just copy .env.example. Of course, if you want to operate in a production environment, change the settings.

cp .env.example .env

Edit a /etc/hosts if you run containers on local

There are three host names.

ex.
127.0.0.1 SERVER_NAME_OF_API          # use GOBEL_NGINX_API_SERVER_NAME in .env
127.0.0.1 SERVER_NAME_OF_CLIENT       # use GOBEL_NGINX_CLIENT_SERVER_NAME in .env
127.0.0.1 SERVER_NAME_OF_ADMIN_CLIENT # use GOBEL_NGINX_ADMIN_CLIENT_SERVER_NAME .env

Build containers

make docker-compose-build

Run containers

make docker-compose-up

Faker

Here is a fake data sql file that can be used for operation verification.

Go to applications

Application URL
gobel-api http:/SERVER_NAME_OF_API/
gobel-admin-client-example-example http://SERVER_NAME_OF_ADMIN_CLIENT/
gobel-client-example http://SERVER_NAME_OF_CLIENT/
prometheus http://localhost:9090/graph
node-exporter http://localhost:9100/
mysqld-exporter http://localhost:9104/
grafana http://localhost:3000/
kibana http://0.0.0.0:5601/
redis-insight http://localhost:8001/

Run in production

See gobel-ops-example for building infrastructure construction of the production environment.

Tips

Elasticsearch may not start when changing the version related to fluentd. In that case, deleting /elasticsearch/nodes may solve the problem.

gobel-grafana is up-to-date
Recreating gobel-elasticsearch ... 
gobel-cadvisor is up-to-date
gobel-node-exporter is up-to-date
Recreating gobel-prometheus    ... 
Recreating gobel-elasticsearch ... done
Recreating gobel-prometheus    ... done
ERROR: for kibana  Container "72a9d83b3ef8" is unhealthy.
ERROR: for fluentd  Container "72a9d83b3ef8" is unhealthy.
Encountered errors while bringing up the project.
make: *** [Makefile:20: docker-compose-up] Error 1
make: *** [deploy] Error 2

UI screenshots

gobel-client-example

An example application using gobel-api.

drawing

gobel-admin-client-example

An example application using gobel-api for admin.

drawing

Grafana

A dashboard for monitoring various logs in cooperation with prometheus using cAdvisor, mysqld-exporter and node-exporter.

Container monitoring

Monitor the resource usage and performance characteristics of running containers.

drawing

MySQL Overview

Monitor the MySQL server metrics.

drawing

Node Exporter Full

Monitor system metrics provided by node exporter.

drawing

Prometheus

Prometheus is an open-source systems monitoring and alerting toolkit. Poll the exporter to collect resources and manage data.

drawing

Node exporter

Node exporter collects system metrics.

drawing

MySQL exporter

MySQL exporter collects MySQL server metrics.

drawing

Kibana

Visualization of logs in cooperation with elasticsearch and fluentd.

  • Application log
    • gobel-api-*
    • gobel-client-*
  • DB log
    • mysql-slow-*
  • Web server log
    • nginx-access-*
    • nginx-error-*

The index name above is an example. See fluent.conf for details.

drawing

License

This project is licensed under the terms of the MIT license.

Author

bmf - Software engineer.