Packages and Solutions¶
Code customizations are distributed as Python packages in Lime CRM. This is the standard way of distributing code in Python.
In Lime CRM we make a difference between a package
and a solution
-
A
solution
is a specific Lime CRM application, with unique customizations and business logic. -
A
package
is a reusable piece of functionality that simply can be installed into asolution
to expand its functionality.
Both packages
and solutions
are created with lime-project
Packages¶
Packages are collections of modules that you create and use. A package can have requirements on other packages. They can also easily be installed in to different Python environments.
Info
A package is distributed as Wheel, commonly installed directly with a Python package manager from a PyPI
The limepkg
namespace¶
Python has a mantra stating:
Explicit is better than implicit.
For that reason, we prefix every package created with lime-project with limepkg
. This makes it easy to distinguish python packages containing customizations from other packages.
Example names: limepkg-my-package
, limepkg-followup
, limepkg-erp-to-crm
Solutions¶
A solution in the Lime CRM world is a Python application. A solution is what's installed on a customers server.
Info
Solutions are packaged into a Wheelhouse; a folder containing all required dependencies.
The difference between a solution and a package is:
- A solution is tied to a single customer.
- It may contain business logic that is very specific for that customer.
- It holds all the dependencies (packages and/or other 3rd party packages) that the solution requires.
- A package in never installed directly on a Lime CRM Server. Instead it's included in the solution as a requirement. This makes it possible for us to keep track of what we have installed on a Lime CRM Server.
Releasing a new version of a project¶
Local build¶
A new release of a project can be built with
lime-buildtools semantic-release-build
lime-buildtools
will read your pyproject.toml
and figure out how your solution
or package
should be built
Using GitHub Actions¶
When you create a new project with lime-project
a CI workflow for GitHub Actions is included in the .github
folder.
A new version of a package or a solution is automatically created when a commit is pushed to master
or a branch is merged to master
.
The CI workflows support pre-releases using a branch named dev
Our CI system uses commit messages to determine the type of changes in the codebase and from that it automatically creates changelogs, bumps the version and publishes a new version on our PyPi server. It also publishes your solution on Git as a release asset under the “releases” tab (https://github.com/Lundalogik/<solution-name>/releases
).
For this to work, you have to follow these rules when writing commit messages. You can still create commits that don't obey these guidelines but those commits will not trigger any new release to be built.
If you want to see the status of your package build, you can browse to the tab "Actions" in your package repo. Here you can also see the logs if you want to find out why a job failed.
Installing a solution in production (on Windows)¶
To install a solution on a server, the Github Actions described above must have been run. Its also possible to install a local build, but that's not our recommendation.
Info
Note that your solution is built for a specific version of Lime CRM. That means that every time you upgrade a server, you need to build the solution again. Otherwise, you might re-install the previous version of Lime CRM when installing the solution.
Follow these steps to install a solution:
-
Download the wheelhouse of a solution from a github release (
https://github.com/Lundalogik/<solution-name>/releases
) or a localdist
folder (if built using lime-buildtools). -
Stop every python process that's running in Lime's Python environment.
-
Run the following command to install the solution on a Lime CRM server:
limefu solution install <solution-{solution-name}-{suffix}.tar.gz>
Finally, you have to restart every installed lime service such that the customizations in the solution is picked up by Lime CRM. After that, the solution is installed! 🎉
On-premise releases¶
Each Lime CRM Server on-premise release has a specific version of the library lime-crm
included.
To enable a matching release, you need to specify the correct version of lime-crm
in your pyproject.toml
file, e.g.:
[tool.poetry.dependencies]
lime-crm = "==1.6.1"
In the list of released on-premise versions, the version of the lime-crm
can be found in parentheses of the version number.
Example
Lime CRM 2020.2.245 (2.22.2) is built against lime-crm==2.22.2
as implied in the version number