This guide explains how to set up the Docker environment for the Last Mile Fleet Solution (LMFS) and On-demand Rides and Deliveries Solution (ODRD) sample backends using Docker Compose.
These are sample backends that should not be used for production purposes, but are used in examples and integration tests.
Note
These services can also be set locally without this docker setup.
See github pages for individual services documentation for more information:
- Docker (and Docker Compose) installed on your machine.
- A Google Cloud Platform account
- With roles:
Fleet Engine Delivery Super User,Fleet Engine Service Super UserandService Account Token Creator
- With roles:
- The Google Cloud SDK installed on your machine.
-
Clone the Repository
Clone this repository to your local machine. If you already have the repository, make sure it's up to date.
git clone [your-repository-url] cd [repository-name] -
Create a .env File
Copy the
.env.samplefile to a new file named.envand edit the file contents to include your specific environment variables.This file should never be committed to version control.
cp .env.sample .env
If you need to update the values in .env file later follow instructions in Updating the .env file section.
[!IMPORTANT] Backend instances share the gcloud login information with the host machine, so you need to set the
GCLOUD_CONFIG_DIRenvironment variable to the path of your local gcloud config directory. This is typically~/.config/gcloudon MacOS and Linux, or%APPDATA%\gcloudon Windows -
Log in to gcloud and set project
Run the following command to acquire new user credentials to use for Application Default Credentials:
gcloud auth application-default login
This will open a browser window asking you to log in to your Google Cloud account.
Set the project to the one you want to use for this example:
gcloud config set project [PROJECT_ID]
With everything set up, you can now run the backend service Docker containers using the following commands:
docker compose upThis will start the services defined in docker-compose.yml, including the LMFS and ODRD backends.
LMFS backend will be available at http://localhost:8091 and ODRD backend at http://localhost:8092.
It is also possible to run individual backend services if there is no need to run all of them at once.
To run only the LMFS backend, use the following command:
docker compose up lmfs-backendTo run only the ODRD backend, use the following command:
docker compose up odrd-backenddocker-compose file also describes a service for running the FleetEngine Auth sample app. As this application has command-line interface, it should be runned with following docker compose run command:
docker compose run fleetengine-authIf there is a need to update the .env file, the services need to be rebuilt for the changes to take effect. This can be done by running the following command:
docker compose build [--no-cache]