oc-doc/docs/development.md
2024-12-10 18:01:58 +01:00

1.9 KiB

OpenCloud base stack

OpenCloud relies on a micro services architecture. Each component could be developed using specific technologies. However, in order to preserve product consistency and ease maintenance activities, we strongly encourage using the following technological stacks.

Web services

Web services are developped in Go using Beego stack

Environment setup

When using pricate repositories like the OpenCloud git forge, you should define it as a private repository

export GOPRIVATE=cloud.o-forge.io

The Beego stack provides the bee cli tool to ease building process :

go get github.com/beego/bee/v2@latest

Project initialization

New component creation

go mod init oc-mycomponent

Refer to other services component main.go file to write a consitent initialisation process

Project build

In order to build the software :

bee run -downdoc=true -gendoc=true

The -downdoc=true -gendoc=true will automatically generate swagger documentation in the /swagger path

If default Swagger page is displayed instead of your api, change url in swagger/index.html file to :

url: "swagger.json"

If annotations are modified without any code changed, a rebuild might not reflect the changes. To force routing information update :

bee generate routers 

GUI compoenents

The GUI are developped using Flutter framework

Environment setup

  • Install Flutter framework
  • Install Android Studio
  • In "Tools"->"SDK Manager"->"Apparenace & Behaviour/System Settings/Android SDK", go to "SDK tools" and tick the "Android SDK command line tools"
  • Run flutter doctor commmand and follow instructions to accept SDK licenses
  • Add Vscode flutter plugin and use Vscode Command palette to create a Flutter project
  • Also set the target Device using command Palette

Project build

Depending on your target platform :

flutter build web
flutter build linux
flutter build windows