LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub

Start Services

Note: the following steps use MySQL database as an example. MariaDB, SQL Server and Postgres should be the same by choosing docker-compose-oauth2-mariadb.yml, docker-compose-oauth2-sqlserver.yml or docker-compose-oauth2-postgres.yml when starting docker-compose.

The current release supports four built-in databases: MySQL, MariaDB, SQLServer and Postgres. If you want to use other databases, you need include the JDBC driver into the classpath and create a datasource config in service.yml file.

In production mode, all services will have docker images downloaded from hub.docker.com or a private docker hub within your organization. And Kubernetes or other docker orchestration tools will be used to manage containers.

For Java 8 in 1.6.x branch, there are two docker images per service and the Redhat based image is only used by customers with OpenShift Platform as it is the only one that is approved.

  • Alpine Linux based image (117MB) which is smaller and recommended for most users.

  • Redhat Linux based image (485MB) with networknt as user instead of root for maximum security.

For Java 11 in master branch, there are two docker images per service.

  • Alpine Linux based with jlink image (95MB) which is recommended for most users.
  • Slim Linux based image (422MB) for user who want to have a full Linux container.

To help the user to understand how each service works and enables the user to modify services, the first section of this tutorial will focus on development mode which will build these services and dockerize them.

For each microservices, we have Dockerfile in the root folder and Dockerfile-Redhat in docker folder. Here is an example:

https://github.com/networknt/light-oauth2/tree/master/client/docker

You can manually build these images one by one per service or leverage light-bot dockerhub task to release all services to docker hub together. For each release of Light, we will push these service to networknt docker hub. You can start these services with the following commands.

git clone https://github.com/networknt/light-docker.git
cd light-docker
docker-compose -f docker-compose-oauth2-mysql.yml up

It will take about 30 seconds to have all services and database up and running. If MySQL image doesn’t exist on your host, it will take longer to download it.

If you have modified docker container config files or want to clean up, please follow the steps to restart services.

docker-compose -f docker-compose-oauth2-mysql.yml down
docker-compose -f docker-compose-oauth2-mysql.yml up

If this is the very first time you start the docker-compose, you might encounter an error as below.

ERROR: Network localnet declared as external, but could not be found. Please create the network manually using `docker network create localnet` and try again.

It is because we are using a docker network called localnet in the docker-compose. As the error message indicates, we need to run the following command to create the network and then rerun the docker-compose.

docker network create localnet

SQLServer

To start light-oauth2 microservices with Microsoft SQL Server.

git clone https://github.com/networknt/light-docker.git
cd light-docker
docker-compose -f docker-compose-oauth2-sqlserver.yml up

Postgres

To start light-oauth2 microservices with Postgres database.

git clone https://github.com/networknt/light-docker.git
cd light-docker
docker-compose -f docker-compose-oauth2-postgres.yml up

If you have modified source code, you need to rebuild the updated service and then rebuild the docker image locally. And before rebuild docker image, you need to remove the existing one with:

docker rmi -f [image id]

Deprecated Databases

We used to support Oracle and MariaDB but marked them deprecated due to some issues.

Oracle was removed due to the licensing issue for the Oracle Client. The Oracle Client driver is not in the maven central and needs a registered user to access from the Oracle repository. Also, the docker image is too big to download. For anyone to use Oracle, they might have Oracle installed already, and it is not necessary to demo with docker here.

MariaDB shares the same driver with MySQL, and MySQL supports SSL by default. We have updated the driver configuration to support SSL, but there is no way for us to enable SSL with the MariaDB docker container. So we have to mark the docker-compose deprecated.

Although the above databases are not supported with docker-compose, you can still use it with a small update in the application. The database scripts are still available for users.

  • About Light
    • Overview
    • Testimonials
    • What is Light
    • Features
    • Principles
    • Benefits
    • Roadmap
    • Community
    • Articles
    • Videos
    • License
    • Why Light Platform
  • Getting Started
    • Get Started Overview
    • Environment
    • Light Codegen Tool
    • Light Rest 4j
    • Light Tram 4j
    • Light Graphql 4j
    • Light Hybrid 4j
    • Light Eventuate 4j
    • Light Oauth2
    • Light Portal Service
    • Light Proxy Server
    • Light Router Server
    • Light Config Server
    • Light Saga 4j
    • Light Session 4j
    • Webserver
    • Websocket
    • Spring Boot Servlet
  • Architecture
    • Architecture Overview
    • API Category
    • API Gateway
    • Architecture Patterns
    • CQRS
    • Eco System
    • Event Sourcing
    • Fail Fast vs Fail Slow
    • Integration Patterns
    • JavaEE declining
    • Key Distribution
    • Microservices Architecture
    • Microservices Monitoring
    • Microservices Security
    • Microservices Traceability
    • Modular Monolith
    • Platform Ecosystem
    • Plugin Architecture
    • Scalability and Performance
    • Serverless
    • Service Collaboration
    • Service Mesh
    • SOA
    • Spring is bloated
    • Stages of API Adoption
    • Transaction Management
    • Microservices Cross-cutting Concerns Options
    • Service Mesh Plus
    • Service Discovery
  • Design
    • Design Overview
    • Design First vs Code First
    • Desgin Pattern
    • Service Evolution
    • Consumer Contract and Consumer Driven Contract
    • Handling Partial Failure
    • Idempotency
    • Server Life Cycle
    • Environment Segregation
    • Database
    • Decomposition Patterns
    • Http2
    • Test Driven
    • Multi-Tenancy
    • Why check token expiration
    • WebServices to Microservices
  • Cross-Cutting Concerns
    • Concerns Overview
  • API Styles
    • Light-4j for absolute performance
    • Style Overview
    • Distributed session on IMDG
    • Hybrid Serverless Modularized Monolithic
    • Kafka - Event Sourcing and CQRS
    • REST - Representational state transfer
    • Web Server with Light
    • Websocket with Light
    • Spring Boot Integration
    • Single Page Application
    • GraphQL - A query language for your API
    • Light IBM MQ
    • Light AWS Lambda
    • Chaos Monkey
  • Infrastructure Services
    • Service Overview
    • Light Proxy
    • Light Mesh
    • Light Router
    • Light Portal
    • Messaging Infrastructure
    • Centralized Logging
    • COVID-19
    • Light OAuth2
    • Metrics and Alerts
    • Config Server
    • Tokenization
    • Light Controller
  • Tool Chain
    • Tool Chain Overview
  • Utility Library
  • Service Consumer
    • Service Consumer
  • Development
    • Development Overview
  • Deployment
    • Deployment Overview
    • Frontend Backend
    • Linux Service
    • Windows Service
    • Install Eventuate on Windows
    • Secure API
    • Client vs light-router
    • Memory Limit
    • Deploy to Kubernetes
  • Benchmark
    • Benchmark Overview
  • Tutorial
    • Tutorial Overview
  • Troubleshooting
    • Troubleshoot
  • FAQ
    • FAQ Overview
  • Milestones
  • Contribute
    • Contribute to Light
    • Development
    • Documentation
    • Example
    • Tutorial
“Start Services” was last updated: July 5, 2021: fixes #275 checked and corrected grammar/spelling for majority of pages (#276) (b3bbb7b)
Improve this page
  • News
  • Docs
  • Community
  • Reddit
  • GitHub
  • About Light
  • Getting Started
  • Architecture
  • Design
  • Cross-Cutting Concerns
  • API Styles
  • Infrastructure Services
  • Tool Chain
  • Utility Library
  • Service Consumer
  • Development
  • Deployment
  • Benchmark
  • Tutorial
  • Troubleshooting
  • FAQ
  • Milestones
  • Contribute