Self-hosting with the prebuilt image
Prerequisites
Section titled “Prerequisites”To deploy the server with Docker you need docker and docker-compose installed. See the guide to installing Docker on all platforms.
On Ubuntu:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-composeBesides Docker, these ports must be reachable:
| Port | Used by | Notes |
|---|---|---|
55230 |
TCU communications | Must be accessible for the TCU to reach the server. |
80 |
Navigation unit | HTTP only, since the navigation unit cannot handle SSL. |
The web portal itself can use SSL by putting an Nginx or Apache server in front of it. See Running behind Nginx or Apache.
Installation and configuration
Section titled “Installation and configuration”-
Clone the repository with git, or download the ZIP from GitHub:
Terminal window git clone https://github.com/developerfromjokela/opencarwings.gitThe only folder you need is
carwingsand its contents. Everything else is optional to keep. -
Create
docker-compose.ymlnext to thecarwingsfolder, using this configuration:docker-compose.yml version: "2.1"services:server:image: ghcr.io/developerfromjokela/opencarwings:maincontainer_name: opencarwings-serverenvironment:PSQL_DATABASE: ${PSQL_NAME}PSQL_USER: ${PSQL_USERNAME}PSQL_PASSWORD: ${PSQL_PASSWORD}PSQL_DATABASE_HOST: dbPSQL_DATABASE_PORT: 5432REDIS_HOST: redisREDIS_PORT: 6379TZ: ${TZ}restart: alwaysvolumes:- ./carwings/:/app/carwings/- ./staticfiles/:/app/staticfiles/- ./mediafiles/:/app/mediafiles/- ./logs/:/app/logs/ports:- "${BACKEND_PORT}:80"- "${TCPSERVER_PORT}:55230"db:image: postgres:14container_name: opencarwings-dbenvironment:PGDATA: /var/lib/postgresql/data/pgdataPOSTGRES_DB: ${PSQL_NAME}POSTGRES_USER: ${PSQL_USERNAME}POSTGRES_PASSWORD: ${PSQL_PASSWORD}volumes:- psql_data:/var/lib/postgresql/datarestart: unless-stoppedredis:container_name: opencarwings-redisimage: redis:7volumes:psql_data: -
Create the
.envfile. Copy.example.envto.envin the same directory and edit it:Terminal window cp .example.env .envVariable Description TZServer timezone, for example Europe/Helsinki.BACKEND_PORTListening port for HTTP traffic, for example 0.0.0.0:80.TCPSERVER_PORTListening port for the TCU server. PSQL_NAMEDatabase name. Keep the default. PSQL_USERNAMEDatabase user name. Keep the default. PSQL_PASSWORDDatabase user password. Set your own, and generate a secure one with uuidgenor another high-entropy source. -
Create the Django settings. Copy
carwings/settings.docker.pytocarwings/settings.pyand modify it:Terminal window cp carwings/settings.docker.py carwings/settings.pySetting Description SECRET_KEYGenerate a secure key with uuidgenor another high-entropy source.ALLOWED_HOSTSIf you host the server behind a domain or IP address (local and/or WAN), add it to the list, for example ["domain.com", "domain2.com"].EMAIL_HOSTSMTP email server address. EMAIL_USE_TLSTrueorFalse.EMAIL_PORTSMTP email server port. EMAIL_HOST_USEREmail account user name. EMAIL_HOST_PASSWORDEmail account password. -
Start the server:
Terminal window docker-compose up -d -
Create an admin account:
Terminal window docker exec -it opencarwings-server python manage.py createsuperuser -
Check that it works. The admin interface is available at
/admin. Log in and confirm everything is operational. -
Disable debug mode. In
carwings/settings.py, setDEBUGtoFalse, then restart the server:Terminal window docker-compose down && docker-compose up -d