Sign inSign up

inlustra/traccar-google-cloud-sql

By inlustra

•Updated about 4 years ago

Traccar with built in Google Cloud SQL drivers

Image
0

120

inlustra/traccar-google-cloud-sql repository overview

⁠Traccar with built in Google Cloud SQL MySQL & Postgresql connectors

Perfect for Cloud Run as the Traccar config file has been replaced with environment variables.

Run on Google Cloud

⁠How to use

You can simply run the Docker image: inlustra/traccar-google-cloud-sql with the required env vars below.

It will default to the Google Cloud SQL MySQL connector, if you are using MySQL, the only env vars required are:

  • DATABASE_USERNAME
  • DATABASE_PASSWORD
  • DATABASE_NAME
  • CONNECTION_NAME

⁠Possible environment variables:

Env varRequiredDescription
DATABASE_USERNAME✓Cloud SQL database user
DATABASE_PASSWORD✓Cloud SQL database password
DATABASE_NAME✓Cloud SQL database name
CONNECTION_NAME✓Go to your Cloud SQL page, create a database and copy the 'Connection Name', it looks something like: myproject:mylocation:mydbname
DATABASE_TYPE✗Used to auto configure the advanced variables, supported options are: 'mysql' (Default), 'postgresql' or 'custom' (Advanced)
DATABASE_PROTOCOL✗Advanced, if DATABASE_TYPE is set to custom, used to manually create JDBC url
DATABASE_DRIVER✗Advanced, if DATABASE_TYPE is set to custom, you can only use those drivers supported by Traccar or loaded via DRIVER_FILE
DATABASE_SOCKET_FACTORY✗Advanced, if DATABASE_TYPE is set to custom, allows loading a custom socket factory via JDBC url
ENABLE_IAM_AUTH✗Used to set enableIamAuth on postgresql socket connections
JDBC_URL_OPTIONS✗Advanced, if DATABASE_TYPE is set to custom, You can use this to append to the JDBC URL, the default URL is: 'jdbc:${DATABASE_TYPE}:///${DATABASE_NAME}?socketFactory=${DATABASE_SOCKET_FACTORY}&cloudSqlInstance=${CONNECTION_NAME}&unixSocketPath=/cloudsql/${CONNECTION_NAME}${JDBC_URL_OPTIONS}'
⁠Note
  • You'll notice that the & symbols have been escaped - Remember, for the username and password you'll have to do the same (I'd recommend avoiding any XML-escape-required characters)

Tag summary

Content type

Image

Digest

sha256:4cb712d91…

Size

179.4 MB

Last updated

about 4 years ago

docker pull inlustra/traccar-google-cloud-sql:0.0.1