Running Corteza Locally Without Docker - Software, Setup, and Workflow

Hi everyone,

I’m trying to set up a local development environment for Corteza without using Docker and would appreciate any guidance. Could anyone help me with the following:

  1. Software to Install:
  • Which essential software (e.g., Go, Node.js, etc.) do I need to install, and what are the recommended versions?
  1. Database Setup:
  • What database is required, and how should I configure it for a local development setup (e.g., PostgreSQL version, configuration steps)?
  1. Environment Configuration:
  • What environment variables or configuration files need to be updated/created to run Corteza without Docker?
  1. Build and Run Commands:
  • What commands do I need to use for building and running Corteza locally?
  • Are there any make commands or custom scripts that would help streamline the process?
  1. General Development Workflow:
  • Could you share a basic development workflow for contributing or testing features in Corteza when not using Docker?

Any advice, documentation, or examples would be really helpful! Thanks in advance.

Hi @martstech ,

You can use the following example setup:

Prerequisites

Server

  • Go (I use version 1.19)
  • PostgreSQL

Client

  • Node.js
  • Yarn

Server Configuration and Running

Refer to the sample environment configuration file for setup instructions (.env.example).

DB_DSN="your database(postgres) DSN configuration"
ENVIRONMENT=dev
DOMAIN=localhost:3000
HTTP_ADDR=localhost:3001

LOG_LEVEL=debug
LOG_DEBUG=true

LOCALE_PATH=../locale
LOCALE_LOG=true
LOCALE_LANGUAGES="en"
LOCALE_DEVELOPMENT_MODE=true
LOCALE_RESOURCE_TRANSLATIONS_ENABLED=true

AUTH_DEVELOPMENT_MODE=true

HTTP_WEBAPP_ENABLED=true
HTTP_API_ENABLED=true

If you have any questions regarding environment variables, please refer to the documentation or the .env.example file.

Server Setup

After configuring the server, run make watch to start it.

Client Setup

To build the Corteza libraries, link them to the web apps, and install the necessary packages, run make dev at the root of the corteza project.

Next, navigate to the web apps’ public directory, create a config.js file, and copy the contents from config.example.js. Then, update window.CortezaAPI to point to your server’s API location.

Once the configuration is complete, run yarn serve on any of the web apps to launch it.

And voila :rocket: , you have Corteza up and running locally.

1 Like

Hi @Mumbi.Kinyanjui,

Thanks for the detailed response! So far, so good. However, when I start the server, I’m encountering the following errors:

13:06:40.444 ERROR could not preload application index HTML {"error": "open webapp/public/admin/index.html: The system cannot find the path specified."}
13:06:40.445 ERROR could not preload application index HTML {"error": "open webapp/public/compose/index.html: The system cannot find the path specified."}
13:06:40.445 ERROR could not preload application index HTML {"error": "open webapp/public/workflow/index.html: The system cannot find the path specified."}
13:06:40.445 ERROR could not preload application index HTML {"error": "open webapp/public/reporter/index.html: The system cannot find the path specified."}
13:06:40.445 ERROR could not preload application index HTML {"error": "open webapp/public/index.html: The system cannot find the path specified."}

It seems like the application is trying to load the HTML files for the web apps (e.g., admin, compose, workflow, etc.), but it can’t find the necessary files in the webapp/public/ directory.

Do you have any idea how I can fix this? Is there something I might have missed in the setup process for the web apps?

Thanks in advance for any help you can offer!

@martstech

You can ignore that error—it’s relevant only when you’re deploying Corteza.

Is the server running?
To run the web apps locally (admin webapp) for example, navigate to client/web/admin, configure config.js, and then run the admin web app with yarn serve

Hi @Mumbi.Kinyanjui,

Thanks for the clarification! I am running the server, but when I run the client, the i18n does not work. Additionally, when I log in to the admin panel, I get a blank page, and I see this error:

WebSocket connection to 'ws://localhost:3000/websocket' failed.

Any idea what might be causing this or how I can fix it?

Thanks in advance!

in this url
https://docs.cortezaproject.org/corteza-docs/2023.9/devops-guide/troubleshooting/index.html#ws-nginx-connection-fail

WebSocket connection failing with Nginx
If the WebSocket connection is failing to establish, you might need to enable Nginx WebSocket proxying.

You can find detailed instructions and further examples in the Nginx documentation.

Inside your nginx.conf file (by default, it is located inside the /etc/nginx directory), add the following lines to the server configuration section;

location /api/websocket {
  proxy_pass http://server:80;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
  proxy_set_header Host $host;
}
2 Likes