The Canonical Application

Related tags

Spring Boot leocloud
Overview

The Canonical Application

This is an example project that demonstrates the CI/CD toolchain to automatically build and deploy an application to a production server. On every push in the master branch the following actions are performed automatically to continousely deploy the full system:

  • compile all parts using Github actions
  • build the docker images on the github runner
  • push the created docker images to the github container registry
  • log into the remote server by ssh
  • install the required packages if they are not available yet
  • pull the docker images on the remote server
  • start up the application on the server using docker-compose

Deployment

The following services are deployed on the production server:

nginx is configured to be a reverse proxy for the Application Server, so that there is no CORS issue when deploying javascript applications. Additionally nginx also serves the web page.

Preparation of your repository

The github runner needs access to your server. So you must specify the hostname or IP-Adress of the server, the username with sudo permission to log in and the private key used for that. The user must be able to sudo without password, see below. The runner also needs a token to push docker images to your repository. Of course we do not check in all that credentials in cleartext, but use github secrets for that purpose.

You must set the following encrypted secrets:

Name Description
SSH_SERVER_PRIVATE_KEY the private key that is allowed to log into the server
SERVER_USER the username used to login to the server
SERVER IP Address or the hostname of the server
REGISTRY_ACCESS_TOKEN the access token to the github container registry

About sudo on your server

We assume that you use an ubuntu distribution, otherwise you must change the setup-server.sh script to use a different package manager.

The user that is used to log into the server must have sudo permission to be able to use sudo without entering a password. If this is not the case add a file named 90-leocloud-users to /etc/sudoers.d/ with the following content:

ubuntu ALL=(ALL) NOPASSWD:ALL

If your user name is not ubuntu, then use your username instead of ubuntu in the line above.

About login to ghcr.io

The github action will ssh into the remote server, log into the github container registry and pull the docker image using commands like this:

echo <access-token> | docker login --username <username> --password-stdin
docker pull ...

For details see the github action in this project.

Service Startup

A docker-compose.yml file is copied to /usr/local/bin/application on the destination server. A systemctl service docker-compose.service is installed to /lib/systemd/system and enabled automatically on the production server, so the application starts up on system boot.

The services can be restarted manually and the log can be seen with:

cd /usr/local/bin/application
sudo systemctl restart docker-compose
docker-compose logs -f

About the firewall

Make sure that you open port 80 on your firewall. All traffic goes through this port.

Using https

If you want to use https, you must add a certificate to nginx, expose it on port 443 and open port 443 on your firewall instead of port 80. In that case nginx terminates https and the application server does not need a certificate, because all internal traffic is done with http.

Cloud

To see how to deploy the same architecture to the cloud see the readme in the k8s subfolder

You might also like...

A hybrid chat android application based on the features of Instagram and Whatsapp having UI just as Telegram.

A hybrid chat android application based on the features of Instagram and Whatsapp having UI just as Telegram.

GupShup About App It is a free online chat android application, enabling user to create a free user account and then log in using the credentials. Aft

May 22, 2022

A Spring Boot - React Petshop Application

zuri-petshop A Spring Boot - React Petshop Application Installation In order to install the development environment, please follow below steps to have

Jun 19, 2022

The state-of-the-art Dashboard of Apache RoccketMQ provides excellent monitoring capability. Various graphs and statistics of events, performance and system information of clients and application is evidently made available to the user.

RocketMQ Dashboard How To Install With Docker get docker image mvn clean package -Dmaven.test.skip=true docker:build or docker pull apacherocketmq/ro

Dec 30, 2022

Geoponics is an E-Commerce Android Based Application Designed for Farmers As Well As Normal Users to Buy and Sell Agricultural goods!

Geoponics is an E-Commerce Android Based Application Designed for Farmers As Well As Normal Users to Buy and Sell Agricultural goods!

Geoponics : E-Commerce Application Geoponics is an E-Commerce Android Based Aplication Designed for Farmers As Well As Normal Users to Buy and Sell Ag

Aug 31, 2021

SpringBoot show case application for reactive-pulsar library (Reactive Streams adapter for Apache Pulsar Java Client)

Reactive Pulsar Client show case application Prerequisites Cloning reactive-pulsar Running this application requires cloning https://github.com/lhotar

Nov 10, 2022

The utility is designed to implement version control of APEX application pages.

The utility is designed to implement version control of APEX application pages.

Oracle APEX version control tool The utility is designed to implement version control of APEX application pages. How it works The developer exports th

Aug 25, 2022

Simple and lightweight application which is checking status of your web services and send a notification if it is down.

rose-uptimer Simple and lightweight application which is checking status of your web services and send a notification if it is down. Example configura

Sep 25, 2022

A lightweight and extensible library to resolve application properties from various external sources.

Externalized Properties A lightweight and extensible library to resolve application properties from various external sources. Twelve Factor Methodolog

Nov 29, 2022

Representational State Transfer + Structured Query Language(RSQL): Demo application using RSQL parser to filter records based on provided condition(s)

Representational State Transfer + Structured Query Language: RSQL Demo application using RSQL parser to filter records based on provided condition(s)

Nov 23, 2022
Comments
  • Update create-deployment.sh output to improve usability

    Update create-deployment.sh output to improve usability

    k8s/create-deployment.sh

    Line 42: "please run now: kubectl -f deployment.yaml" -> "please run now: kubectl apply -f deployment.yaml"

    as kubectl -f deployment.yaml does not work, contrary to kubectl apply -f deployment.yaml like specified in the docu

    opened by Zeno-Paukner 0
Owner
Christian Aberger
Senior Software Developer Programming Teacher at http://www.htl-leonding.ac.at and http://htl-perg.ac.at
Christian Aberger
This repository is for Todo application. This contains the Backend part of the application.

Todo Application 개요(Abstract) 개인용 할일 목록 리스트 앱플리케이션 구축 (Personal Todo List Application) 목적 1. React.js기초, AWS서버 활용, 스프링 부트 공부 목적으로 프로젝트 시작했습니다.

Thom 3 Jan 8, 2022
Android application made during an introduction class to mobile application development.

Reflex Revolution Android application made during an introduction class to mobile application development. Contributors Hailey Savoie Carter Moore Fre

Frederic Verret 3 Aug 27, 2022
Melnica Server is a custom basic Servlet Container application which depends on Socket Programming.

Melnica Server Melnica Server is a custom basic Servlet Container application which depends on Socket Programming. The Description of Project Melnica

Batuhan Düzgün 18 Jun 26, 2022
Hotels Management System - JavaFX GUI Application

Hotels Management System Hotels Management System - JavaFX Application Does this repo deserve a star? I hope that. Let's talk about what can my progra

Samer Al-Sa'dawi 22 Aug 29, 2022
Multi-Tenant Spring Boot Application with separate databases using Hibernate and H2.

Multi-Tenant Spring Boot Application A Spring Boot application that utilises a multi-tenancy architecture by providing multiple databases, one for eac

Alex Gschnitzer 15 May 9, 2022
Dynamic Configuration Capability for SpringBoot Application

Spring Boot Dynamic Config Hot-reload your SpringBoot configurations, with just a '@DynamicConfig' annotation, the simplest solution, ever. English 简体

Joey Yang 153 Jan 3, 2023
This Web Application Allows A user to upload a two minutes Video. It uses Server Side Capabilities of Nodejs and Spring Boot .

VideoStreamingApplication Purpose Of This Application These days trend of short videos are on rise youtube recently realsed "Shorts" . So , taking ins

Prateek Kumar 57 Nov 13, 2022
Spring-boot application using redis as a caching database

Java Spring-boot application using Redis as a caching database Running Application Entities involved Two main entities are involved MasterHouse (maste

null 18 Aug 9, 2022
Two Spring-boot applications registering themselves to an spring-boot-admin-server application as separate clients for the purpose of monitoring and managing the clients

Spring-boot-admin implementation with 1 Server and 2 clients Creating a Server application to monitor and manage Spring boot applications (clients) un

null 6 Dec 6, 2022
The Quotation Management application is a API REST created using Spring Boot framework.

✅ Quotation Management API - Done ✅ About • Features • Setup • Technologies • Author • License ?? About The Quotation Management application is a API

Vanessa Swerts 6 Apr 29, 2022