Skip to content

Commit ebf0df5

Browse files
committed
Merge branch 'main' of https://github.com/getlago/lago
2 parents 017e7fd + 57a53ef commit ebf0df5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4419
-14
lines changed

.env.development.default

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LAGO_SIDEKIQ_WEB=true
66
LAGO_CLICKHOUSE_ENABLED=true
77
LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
88
LAGO_DISABLE_SEGMENT=true
9+
LAGO_DISABLE_PDF_GENERATION=false
910
LAGO_DISABLE_WALLET_REFRESH=true
1011
LAGO_USE_AWS_S3=false
1112

@@ -24,10 +25,10 @@ REDIS_URL=redis://redis:6379
2425
LAGO_REDIS_CACHE_URL=redis://redis:6379
2526
LAGO_PDF_URL=http://pdf:3000
2627
LAGO_DATA_API_URL=http://data_api
27-
LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
28-
LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
29-
LAGO_KAFKA_ENRICHED_EVENTS_TOPIC=events_enriched
30-
LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
28+
LAGO_EVENTS_PROCESSOR_DATABASE_MAX_CONNECTIONS=200
29+
LAGO_REDIS_STORE_URL=redis:6379
30+
LAGO_REDIS_STORE_PASSWORD=
31+
LAGO_REDIS_STORE_DB=1
3132

3233
# Misc
3334
LAGO_FROM_EMAIL=noreply@getlago.com
@@ -44,7 +45,7 @@ SIDEKIQ_WEBHOOK=false
4445

4546
# External API keys
4647
LAGO_DATA_API_BEARER_TOKEN=changeme
47-
LAGO_LICENSE="35be6ead-a590-4593-9a45-01f62c248faa"
48+
LAGO_LICENSE=
4849
NANGO_SECRET_KEY=
4950
SEGMENT_WRITE_KEY=
5051

@@ -53,3 +54,19 @@ SECRET_KEY_BASE=your-secret-key-base-hex-64
5354
LAGO_ENCRYPTION_PRIMARY_KEY=your-encrpytion-primary-key
5455
LAGO_ENCRYPTION_DETERMINISTIC_KEY=your-encrpytion-deterministic-key
5556
LAGO_ENCRYPTION_KEY_DERIVATION_SALT=your-encrpytion-derivation-salt
57+
58+
# Kafka
59+
LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
60+
LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
61+
LAGO_KAFKA_ENRICHED_EVENTS_TOPIC=events_enriched
62+
LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
63+
LAGO_KAFKA_SCRAM_ALGORITHM=
64+
LAGO_KAFKA_TLS=
65+
LAGO_KAFKA_USERNAME=
66+
LAGO_KAFKA_PASSWORD=
67+
LAGO_KAFKA_EVENTS_CHARGED_IN_ADVANCE_TOPIC=events_charged_in_advance
68+
LAGO_KAFKA_EVENTS_DEAD_LETTER_TOPIC=events_dead_letter
69+
LAGO_KAFKA_CONSUMER_GROUP=lago_dev
70+
LAGO_KARAFKA_WEB=
71+
LAGO_KARAFKA_PROCESSING=
72+
LAGO_KARAFKA_WEB_SECRET=
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Build Events Processor Production Image"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- "events-processor/**"
8+
workflow_dispatch:
9+
10+
jobs:
11+
build-processor-image:
12+
runs-on: ubuntu-latest
13+
name: Build Events Processor Image
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Configure AWS Credentials
17+
uses: aws-actions/configure-aws-credentials@v4
18+
with:
19+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
20+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
21+
aws-region: us-east-1
22+
- name: Login to Amazon ECR
23+
id: login-ecr
24+
uses: aws-actions/amazon-ecr-login@v2
25+
- name: Set short sha
26+
id: sha_short
27+
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
- name: Docker tag
31+
id: docker_tag
32+
env:
33+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
34+
ECR_REPOSITORY: lago-events-processor
35+
IMAGE_TAG: ${{ steps.sha_short.outputs.sha_short }}
36+
run: echo "tag=$(echo $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG)" >> $GITHUB_OUTPUT
37+
- name: Build and push
38+
uses: docker/build-push-action@v6
39+
with:
40+
context: ./events-processor
41+
push: true
42+
tags: ${{ steps.docker_tag.outputs.tag }}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Events Processor Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
paths:
13+
- "events-processor/**"
14+
15+
jobs:
16+
test:
17+
name: Run go tests
18+
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
working-directory: ./events-processor
22+
23+
services:
24+
postgres:
25+
image: postgres:14-alpine
26+
ports:
27+
- "5432:5432"
28+
env:
29+
POSTGRES_DB: lago
30+
POSTGRES_USER: lago
31+
POSTGRES_PASSWORD: lago
32+
33+
env:
34+
DATABASE_URL: "postgres://lago:lago@localhost:5432/lago"
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v3
39+
40+
- name: Checkout lago expression code
41+
uses: actions/checkout@v3
42+
with:
43+
repository: getlago/lago-expression
44+
path: lago-expression
45+
ref: v0.1.4
46+
47+
- name: Build lago-expression
48+
working-directory: ./lago-expression
49+
run: cargo build --release
50+
51+
- name: Copy lago-expression shared library
52+
working-directory: ./lago-expression
53+
run: |
54+
mkdir -p /tmp/libs
55+
sudo cp ./target/release/libexpression_go.so /usr/local/lib/libexpression_go.so
56+
sudo ldconfig
57+
58+
- name: Setup Go
59+
uses: actions/setup-go@v4
60+
with:
61+
go-version: "1.24.0"
62+
63+
- name: Run tests
64+
run: go test -v ./...

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
/extra/ssl/nginx*
1111
/traefik/certs/*
1212
*.terraform*
13+
/deploy/letsencrypt

PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Please, go through these steps before you submit a PR.
1111

1212
c. You have only one commit (if not, squash them into one commit).
1313

14-
d. `npm test` doesn't throw any error. If it does, fix them first and amend your commit (`git commit --amend`).
14+
d. `pnpm test` doesn't throw any error. If it does, fix them first and amend your commit (`git commit --amend`).
1515

1616
3. **After** these steps, you're ready to open a pull request.
1717

api

Submodule api updated 1096 files

deploy/.env.traefik.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
LAGO_DOMAIN=
2+
LAGO_ACME_EMAIL=

deploy/README.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Lago Deploy
2+
3+
This repository contains the necessary files to deploy the Lago project.
4+
5+
## Docker Compose Local
6+
7+
To deploy the project locally, you need to have Docker and Docker Compose installed on your machine.
8+
This configuration can be used for small production usages but it's not recommended for large scale deployments.
9+
10+
### Get Started
11+
12+
1. Get the docker compose file
13+
14+
```bash
15+
curl -o docker-compose.yml https://raw.githubusercontent.com/getlago/lago/main/deploy/docker-compose.local.yml
16+
```
17+
18+
2. Run the following command to start the project:
19+
20+
```bash
21+
docker compose up --profile all
22+
23+
# If you want to run it in the background
24+
docker compose up -d --profile all
25+
```
26+
27+
## Docker Compose Traefik
28+
29+
This configuration provide Traefik as a reverse proxy to ease your deployment.
30+
It supports SSL with Let's Encrypt. :warning: You need a valid domain (with at least one A or AAA record)!
31+
32+
1. Get the docker compose file
33+
34+
```bash
35+
curl -o docker-compose.yml https://raw.githubusercontent.com/getlago/lago/main/deploy/docker-compose.traefik.yml
36+
curl -o .env https://raw.githubusercontent.com/getlago/lago/main/deploy/.env.traefik.example
37+
```
38+
39+
2. Replace the .env values with yours
40+
41+
```bash
42+
LAGO_DOMAIN=domain.tld
43+
LAGO_ACME_EMAIL=email@domain.tld
44+
```
45+
46+
3. Run the following command to start the project
47+
48+
```bash
49+
docker compose up --profile all
50+
51+
# If you want to run it in the background
52+
docker compose up -d --profile all
53+
```
54+
55+
## Configuration
56+
57+
### Profiles
58+
59+
The docker compose file contains multiple profiles to enable or disable some services.
60+
Here are the available profiles:
61+
- `all`: Enable all services
62+
- `all-no-pg`: Disable the PostgreSQL service
63+
- `all-no-redis`: Disable the Redis service
64+
- `all-no-keys`: Disable the RSA keys generation service
65+
66+
This allow you to start only the service you want to use, please see the following sections for more information.
67+
68+
```bash
69+
# Start all services
70+
docker compose up --profile all
71+
72+
# Start without PostgreSQL
73+
docker compose up --profile all-no-pg
74+
75+
# Start without Redis
76+
docker compose up --profile all-no-redis
77+
78+
# Start without PostgreSQL and Redis
79+
docker compose up --profile all-no-db
80+
81+
# Start without RSA keys generation
82+
docker compose up --profile all-no-keys
83+
84+
# Start without PostgreSQL, Redis and RSA keys generation
85+
docker compose up
86+
```
87+
88+
### PostgreSQL
89+
90+
It is possible to disable the usage of the PostgreSQL database to use an external database instance.
91+
92+
1. Set those environment variables:
93+
94+
- `POSTGRES_USER`
95+
- `POSTGRES_PASSWORD`
96+
- `POSTGRES_DB`
97+
- `POSTGRES_HOST`
98+
- `POSTGRES_PORT`
99+
- `POSTGRES_SCHEMA` optional
100+
101+
2. Run the following command to start the project without PostgreSQL:
102+
103+
```bash
104+
docker compose up --profile all-no-pg
105+
```
106+
107+
### Redis
108+
109+
It is possible to disable the usage of the Redis database to use an external Redis instance.
110+
111+
1. Set those environment variables:
112+
113+
- `REDIS_HOST`
114+
- `REDIS_PORT`
115+
- `REDIS_PASSWORD` optional
116+
117+
2. Run the following command to start the project without Redis:
118+
119+
```bash
120+
docker compose up --profile all-no-redis
121+
```
122+
123+
### RSA Keys
124+
125+
Those docker compose file generates an RSA Keys pair for the JWT tokens generation.
126+
You can find the keys in the `lago_rsa_data` volume or in the `/app/config/keys` directory in the backends containers.
127+
If you do not want to use those keys:
128+
- Remove the `lago_rsa_data` volume
129+
- Generate your own key using `openssl genrsa 2048 | base64 | tr -d '\n'`
130+
- Export this generated key to the `LAGO_RSA_PRIVATE_KEY` env var.
131+
- Run the following command to start the project without the RSA keys generation:
132+
133+
```bash
134+
docker compose up --profile all-no-keys
135+
```
136+
137+
*All BE Services use the same RSA key, they will exit immediately if no key is provided.*

0 commit comments

Comments
 (0)