All pages
Powered by GitBook
1 of 1

Loading...

Self-Hosting Aera

Follow the steps below to set up the Aera platform on your local machine.

1. Start the Docker-Compose Stack

The backend requires some middleware, including PostgreSQL, Redis, and Weaviate, which can be started together using docker-compose.

2. Copy .env.example to .env

3. Generate a SECRET_KEY in the .env File

For Linux:

For Mac:

4. Create Environment

Aera API service uses to manage dependencies. First, you need to add the Poetry shell plugin, if you don't have it already, in order to run in a virtual environment. [Note: Poetry shell is no longer a native command, so you need to install the Poetry plugin beforehand]

Then, you can execute poetry shell to activate the environment.

5. Install Dependencies

6. Run Migrate

Before the first launch, migrate the database to the latest version.

7. Start Backend

8. Start Aera Web Service

Follow the instructions for setting up the frontend (see below) to start the web service.

9. Set Up Your Application

Once the web service is running, visit http://localhost:3000 to begin setting up your application.

10. Handle and Debug Async Tasks

If you need to handle and debug async tasks (such as dataset importing or document indexing), start the worker service:

Testing

1. Install Dependencies for Both Backend and Test Environment

2. Run Tests Locally with Mocked System Environment Variables


Frontend Setup

Getting Started

Before starting the web frontend service, ensure the following environment is ready:

  • Node.js >= v22.11.x

  • pnpm v10.x

First, install the dependencies:

Then, configure the environment variables. Create a file named .env.local in the current directory and copy the contents from .env.example. Modify the values of these environment variables according to your requirements:

For production release, change this to PRODUCTION:

The deployment edition:

The base URL of the console application, which refers to the Console base URL of the web service if the console domain is different from the API or web app domain:

The URL for the web app:

SENTRY configuration:

Finally, run the development server:

Visit http://localhost:3000 in your browser to see the result.

Deploy on Server

First, build the app for production:

Then, start the server:

If you want to customise the host and port:

If you want to customise the number of instances launched by PM2, you can configure PM2_INSTANCES in the docker-compose.yaml or Dockerfile.

cd ../docker
cp middleware.env.example middleware.env
# Change the profile to another vector database if you're not using Weaviate
docker compose -f docker-compose.middleware.yaml --profile weaviate -p aera up -d
cd ../api
Poetry
cp .env.example .env
sed -i "/^SECRET_KEY=/c\SECRET_KEY=$(openssl rand -base64 42)" .env
secret_key=$(openssl rand -base64 42)
sed -i '' "/^SECRET_KEY=/c\\
SECRET_KEY=${secret_key}" .env
poetry self add poetry-plugin-shell
poetry env use 3.12
poetry install
poetry run python -m flask db upgrade
poetry run python -m flask run --host 0.0.0.0 --port=5001 --debug
poetry run python -m celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion
poetry install -C api --with dev
poetry run -P api bash dev/pytest/pytest_all_tests.sh
pnpm install
cp .env.example .env.local
NEXT_PUBLIC_DEPLOY_ENV=DEVELOPMENT
NEXT_PUBLIC_EDITION=SELF_HOSTED
NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api
NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api
NEXT_PUBLIC_SENTRY_DSN=
pnpm run dev
pnpm run build
pnpm run start
pnpm run start --port=3001 --host=0.0.0.0