Dev environment¶
While developing locally you will need to run your project. You can install a local Lime Server and needed infrastructure, but this is quite cumbersome. An easier, faster and more lightweight solution is described here
Info
This dev environment does not configure LDC and/or Lisa. If you want to run the desktop client or Lisa, you have to manually configure and install those services.
Setting up your environment¶
Prerequisites¶
- A
solution
(orlimepkg-package
) created/cloned downloaded to your computer. lime-project
,poetry
anddocker
installed on your machine and available in yourPATH
.- A backup file of a "Lime Database"
Quick start¶
Setting up the dev environment is very simple. All you need to do is the following:
- Open a terminal and change your working directory to the root of your
solution
(orlimepkg-
) - Put a ".bak" file in your projects root folder. (Important: Ensure you only have a single .bak file in the folder)
- Run the command
lime-project env prepare
. This command might take quite a while the first time you run it (see more info below)
What does lime-project env prepare
do?¶
It runs a lot of different commands, here's a brief summary about what it does:
- It scaffolds files needed for your dev environment (Executes the command
lime-project generate tool environment
) - It runs poetry install (and creates a poetry.lock file if that doesn't already exist)
- It copies the backup file from the projects root folder in to
.lime/backups
. - It sets up a docker-compose environment (It runs
docker-compose up -d
) - It restores and upgrades your Lime Database
- It creates a search index if there's not much data in your database. Otherwise it prompts and asks if you would like to index the database.
The command lime-project generate tool environment
¶
This command is automatically executed by lime-project env prepare
. Thus you don't need to run it but here's a summary about what it does.
The following files are created when you run this command:
.env
: A file with environmental variables to tell the Lime Services to use the local folder for config and static files.lime
: A folder containing config, logs, infrastructure info, application info and static files.lime/config/config.yaml
: An environmental config file.vscode/launch.json
- A VSCode launch config file
Info
The files in the .lime
folder is autogenerated and should therefore not be commited to your repo.
Info
If you want to change the default lime-config configuration for your environment, you can manually edit the .lime/config/config.yaml
file.
Restoring a database¶
You can restore a database using limefu
Put a .bak
file in .lime/backups/
and run
$ limefu database restore -b /.lime/backups/[name].bak -a [your-project-name]
Info
Your local ./lime/backups/
is mounted as a volume to the SQL Server in /.lime/backups/
Starting the services and debugging¶
VS Code¶
Open your solution in VS Code. You can now launch and debug any of the services via VSCode.
Commandline¶
- Activate your python venv (run
poetry shell
) - Run the service you want to run, for instance the webserver (
flask run
) or the eventhandler (lime-event-handler
)