New Project
Level: Intermediate
Keywords: new SAMO project
The result: initial metadata needed for new project set up
How to set up new SAMO Project?β
This page describes the steps needed to set up a new SAMO project, meaning its structure on GitLab (optional), configuration of project environments and initialization metadata. The part concerning installation of Application and DB Server and Deployment of project software components is described in the Installation section on the SAMO SharePoint portal. The results after finishing this guide are:
- created collaboration environment for implementation works
- established continuous delivery of changes to different project environments
- on server running SAMO application with empty Cockpit
GitLab set up (optional)β
GitLab is managed by SAMO support, who takes care of creating structure for new projects, setting up the delivery process using GitLab Continuous Integration, creating new user groups and assigning access rights.
Internal GitLabβ
Each customer should have its own space in GitLab where we should manage all of its projects. There should be someone (Maintainer) who will take care about the customer and this person should also add memberships to others.
GitLab group: https://gitlab/samo/customers/CUSTOMER
Developer can ask customer's Maintainer for membership. Maintainer should receive membership in the same time when the group is created.
In newly created group we should create project for the customer
- https://gitlab/samo/customers/CUSTOMER/CUSTOMER-project
If necessary create metadata-packages archive folder and projects in the archive folder for metadatas of the project.
- https://gitlab/samo/customers/CUSTOMER/metadata-packages>
- https://gitlab/samo/customers/CUSTOMER/metadata-packages/CUSTOMER-PACKAGE
If developer team wants to keep tracks on changes create changelog.md file and doc folder
- https://gitlab/samo/customers/CUSTOMER/CUSTOMER-project/changelog.md
- https://gitlab/samo/customers/CUSTOMER/CUSTOMER-project/doc
Continuous integrationβ
For building of docker images we use CI in GitLab. Each project should have its own dev server with GitLab runners installed. More information about installation of Gitlab runners can be found in Lighthouse, for Windows and Linux.
The CI in GitLab project and share runners must be enabled.
- Settings -> General -> Permissions -> Pipelines
- Settings -> CI/CD -> Runners -> Enable shared runners
Create customer group in external GitLabβ
External GitLab (https://git.asseco-ce.com) is used as Docker registry for our delivery for Docker images. Therefore, each project that creates Docker image has to have the same repository also in the external GitLab - this has to be manually created and maintained.
The delivery of docker images at customer's side id done through Docker and login to our <docker.asseco-ce.com> registry. For these purposes new customer specific credentials must be created.
This require multiple steps for customer's Maintainer to do:
- ask HelpDesk for email group in this form
samo-CUSTOMER-git@asseco-ce.com - ask GitLab administrators to create external user for the email group
- create groups and projects that should have Docker registry
- assign the newly created user for all projects that should be accessible
Repository structureβ
In order to understand how to manage all your project metadata, at first you need to understand the folder structure of corresponding repositories. If you work on conventional project (project consisting of only one repository), you have all your content in one repository. However, more often you will have a packaged project, and then you use two kinds od repositories for your project:
- ONE project repository with configuration of your project environments, docker, continuous integration and others
- MANY package repositories containing metadata configurations for the content and functionality of your application
Project repository structureβ
Project repository structure is generally very variable and depends on which software components are being used in your project. It is usually set up together with the server installation.
Next, the common project repository structure will be described.
project-repository (e.g. samo-demo-project)
β
ββββenvironments
β β
β ββββdev //environment files for developers project environment
β β β
β β ββββ.env //variables for docker compose
β β ββββdev.env //variables for software components
β β ββββdocker-compose.yml //Docker setup, delivery
β β ββββenvironment.properties //gateway environment specific properties
β β ββββlocal.env //environment variables for local project setup
β β ββββremote.env //environment variables for remote project setup
β β ββββlocal.properties //gateway local environment properties
β β ββββlocaltron.json //presets for <a href = "/howToStart/prerequisites/tools/#localtron">Localtron</a>
β β ββββpackage-lock.json //project (dev env) specific versions of packages for installation
β β ββββpackages.json //project (dev env) dependencies to packages containing metadata configurations
β β
β ββββtest //environment files for test project environment
β ββββdistrib //environment files for distrib project environment
ββββartefacts //used to store migration and update SQL scripts
ββββdoc //contains files needed to integrate project to Lighthouse
β
ββββ.gitlab-ci.yml //contains definition of the Gitlab CI configuration
ββββchangelog.md //file for storing latest updates on project
Package repository structureβ
Package repository structure on the highest level consists of package.json, dynamic-app, gateway, lids-business-service and lids-as folders. The package.json file contains dependencies to other packages.
{
"name": "samo-init-demo",
"version": "1.0.0",
"dependencies": {
"samo-base": "git+ssh://git@gitlab:20022/samo/metadata/packages/base/samo-base.git#master",
"lids-base": "git+ssh://git@gitlab:20022/samo/metadata/packages/base/lids-base.git#master"
}
}
With the new packageing approach, there is a possibility to include multiple packages in one gitlab repository. Also the configuration of dependencies in package.json is different.
{
"name": "@samo-demo/samo-demo",
"version": "7.7.0",
"configurationPackage" : true,
"dependencies": {
"@samo/samo-base": "~8.3.0",
"@samo-demo/lids-demo": "~7.7.0"
}
}
Structure of remaining folders is described in Lighthouse separately for each software component (Gateway, Dynamic-App, Lids-business-service).
Initialization metadataβ
In order to get the application up and running (with empty cockpit), some basic initialization metadata are needed. To make their preparation easier, you can downlaod prepared samo-init-demo package from Gitlab.
First, you need to copy the content either to the metadata folder of your conventional project or to some base package repository which is being used by your project.
Second, you need to edit certain parts in these sample metadata. Basically you can search for init keyword (which represents our project/application name) and change it according to your application and project name.
- Rename the
samo-init-demofolder according to your project package name. - Change the
nameandversionof the package inpackage.json(or completely remove this file for conventional projects). Also check, if you want to use the packages, which are referenced independencies. - Rename
..gateway/applications/init.jsonfile based on your own application name. In this file changeclientsname and application name indefaultDataSourceanddefaultAuthorization.requiredRole. - Rename
..gateway/clients/init-dynamic-client.jsonfile base on your own client name. In this file changeinitapplication part inconfigurationPartsbased on your own application name. Notice that the version of Dynamic-App components is defined using environment property. You will find it in your project repository fileenvironment.properties. - Rename
..lids-business-service/tenants/asseco-ce.jsonfile names with your own tennant name. - Change application name in your tennant configuration (
..gateway/tenants/asseco-ce.json). - Rename
..\dynamic-app\initfolder based on your own application name. - Change your client name (which you have defined in step 4.) also in
..\dynamic-app\init\components\index.html. - Change your application name in
..\dynamic-app\init\components\manifest.jsoninnameandshort_name. - Replace the base
..lids-as/project/lids-as/model/model.xmwith your own LIDS model.
Third, you need to commit and push these changes to Gitlab and usually start the Pipeline, which will upload the content to the project server.
Publish project packagesβ
The project-install command which starts the local implementation environment uses published packages from packages-repository. Therefore after setting up new packaged project, you also need to publish first versions of your project packages either manually and set up Gitlab pipeline. For more informations, see Using packages in project.