mirror of
https://github.com/twentyhq/twenty.git
synced 2026-06-11 09:26:53 -04:00
## What & why The audit-log viewer lived as a full-screen page reachable only via a "View Logs" button buried in the **Security** tab. This surfaces it as the **third tab in General settings** (`General | Security | Logs`), consistent with the other tabs. ## Changes - **Relocated** the event-logs module `pages/settings/security/event-logs/` → `modules/settings/event-logs/` and render it as tab content instead of a `FullScreenContainer` page. Dropped `SettingsPath.EventLogs`, its route, and the fullscreen handling in favor of the `general#logs` hash tab. - **Security tab:** removed the "View Logs" entry; kept the log-retention setting there. - **In-tab gating** (shown to users with the Security permission): Enterprise upgrade card when not entitled, a clear "ClickHouse not configured" placeholder otherwise (derived from client config), and the query is skipped when disabled. Replaces a bespoke error component that string-matched error messages with the shared `SettingsEmptyPlaceholder` / `SettingsEnterpriseFeatureGateCard`. - **Layout:** boxed content column with the table selector + filters grouped in a `Card` and the results table below, matching settings conventions. Kept the existing fixed filters (page/event name, member, period) rather than recreating the record-view filter chips (those are tightly coupled to record/view context). Frontend + `twenty-shared` only — no changes to the log query or data. ## Test plan - [x] `npx nx typecheck twenty-front` and `npx nx lint twenty-front` pass - [x] Settings → General shows three tabs; Logs is the third; breadcrumb stays "Workspace / General" - [x] With Enterprise + ClickHouse: table selector, filters, refresh, and the paginated table work - [x] Non-Enterprise: Enterprise upgrade card shown; no failing query fires - [ ] Enterprise without ClickHouse: shows the "ClickHouse not configured" placeholder - [ ] Security tab still shows the log-retention setting and the "View Logs" button is gone - [ ] A user without the Security permission sees neither the Security nor Logs tab
166 lines
6.1 KiB
YAML
166 lines
6.1 KiB
YAML
name: CI Docker
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
pull_request:
|
|
merge_group:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
jobs:
|
|
changed-files-check:
|
|
if: github.event_name != 'merge_group'
|
|
uses: ./.github/workflows/changed-files.yaml
|
|
with:
|
|
files: |
|
|
packages/twenty-docker/**
|
|
docker-compose.yml
|
|
test-compose:
|
|
needs: changed-files-check
|
|
if: needs.changed-files-check.outputs.any_changed == 'true'
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
|
# Pull base images through Google's Docker Hub mirror — avoids Docker Hub
|
|
# rate limits and needs no credentials (this repo is public).
|
|
- name: Configure Docker Hub mirror
|
|
run: |
|
|
echo '{"registry-mirrors":["https://mirror.gcr.io"]}' | sudo tee /etc/docker/daemon.json
|
|
sudo systemctl restart docker
|
|
- name: Run compose
|
|
run: |
|
|
echo "Patching docker-compose.yml..."
|
|
yq eval 'del(.services.server.image)' -i docker-compose.yml
|
|
yq eval '.services.server.build.context = "../../"' -i docker-compose.yml
|
|
yq eval '.services.server.build.dockerfile = "./packages/twenty-docker/twenty/Dockerfile"' -i docker-compose.yml
|
|
yq eval '.services.server.build.target = "twenty"' -i docker-compose.yml
|
|
yq eval '.services.server.restart = "no"' -i docker-compose.yml
|
|
|
|
echo "Setting up .env file..."
|
|
cp .env.example .env
|
|
echo "Generating secrets..."
|
|
echo "" >> .env
|
|
echo "# === Randomly generated secrets ===" >>.env
|
|
echo "APP_SECRET=$(openssl rand -base64 32)" >>.env
|
|
echo "PGPASSWORD_SUPERUSER=$(openssl rand -hex 16)" >>.env
|
|
|
|
echo "Docker compose up..."
|
|
docker compose up -d || {
|
|
echo "Docker compose failed to start"
|
|
docker compose logs
|
|
exit 1
|
|
}
|
|
docker compose logs db server -f &
|
|
pid=$!
|
|
|
|
echo "Waiting for database to start..."
|
|
count=0
|
|
while [ ! $(docker inspect --format='{{.State.Health.Status}}' twenty-db-1) = "healthy" ]; do
|
|
sleep 1;
|
|
count=$((count+1));
|
|
if [ $(docker inspect --format='{{.State.Status}}' twenty-db-1) = "exited" ]; then
|
|
echo "Database exited"
|
|
docker compose logs db
|
|
exit 1
|
|
fi
|
|
if [ $count -gt 300 ]; then
|
|
echo "Failed to start database after 5 minutes"
|
|
docker compose logs db
|
|
exit 1
|
|
fi
|
|
echo "Still waiting for database... (${count}/60)"
|
|
done
|
|
|
|
echo "Waiting for server to start..."
|
|
count=0
|
|
while [ ! $(docker inspect --format='{{.State.Health.Status}}' twenty-server-1) = "healthy" ]; do
|
|
sleep 1;
|
|
count=$((count+1));
|
|
if [ $(docker inspect --format='{{.State.Status}}' twenty-server-1) = "exited" ]; then
|
|
echo "Server exited"
|
|
docker compose logs server
|
|
exit 1
|
|
fi
|
|
if [ $count -gt 300 ]; then
|
|
echo "Failed to start server after 5 minutes"
|
|
docker compose logs server
|
|
exit 1
|
|
fi
|
|
echo "Still waiting for server... (${count}/300s)"
|
|
done
|
|
working-directory: ./packages/twenty-docker/
|
|
test-app-dev:
|
|
needs: changed-files-check
|
|
if: needs.changed-files-check.outputs.any_changed == 'true'
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
|
# Pull base images through Google's Docker Hub mirror — avoids Docker Hub
|
|
# rate limits and needs no credentials (this repo is public).
|
|
- name: Configure Docker Hub mirror
|
|
run: |
|
|
echo '{"registry-mirrors":["https://mirror.gcr.io"]}' | sudo tee /etc/docker/daemon.json
|
|
sudo systemctl restart docker
|
|
- name: Create frontend placeholder
|
|
run: |
|
|
mkdir -p packages/twenty-front/build
|
|
echo '<html><body>CI placeholder</body></html>' > packages/twenty-front/build/index.html
|
|
- name: Build app-dev image
|
|
run: |
|
|
docker build \
|
|
--target twenty-app-dev \
|
|
-f packages/twenty-docker/twenty/Dockerfile \
|
|
-t twenty-app-dev-ci \
|
|
.
|
|
- name: Start container
|
|
run: |
|
|
docker run -d --name twenty-app-dev \
|
|
-p 2020:2020 \
|
|
twenty-app-dev-ci
|
|
docker logs twenty-app-dev -f &
|
|
- name: Wait for server health
|
|
run: |
|
|
echo "Waiting for twenty-app-dev to become healthy..."
|
|
count=0
|
|
while true; do
|
|
status=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:2020/healthz 2>/dev/null || echo "000")
|
|
if [ "$status" = "200" ]; then
|
|
echo "Server is healthy!"
|
|
curl -s http://localhost:2020/healthz
|
|
break
|
|
fi
|
|
|
|
container_status=$(docker inspect --format='{{.State.Status}}' twenty-app-dev 2>/dev/null || echo "unknown")
|
|
if [ "$container_status" = "exited" ]; then
|
|
echo "Container exited unexpectedly"
|
|
docker logs twenty-app-dev
|
|
exit 1
|
|
fi
|
|
|
|
count=$((count+1))
|
|
if [ $count -gt 300 ]; then
|
|
echo "Server did not become healthy within 5 minutes"
|
|
docker logs twenty-app-dev
|
|
exit 1
|
|
fi
|
|
echo "Still waiting... (${count}/300s) [HTTP ${status}]"
|
|
sleep 1
|
|
done
|
|
ci-test-docker-status-check:
|
|
if: always() && !cancelled()
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
needs: [changed-files-check, test-compose, test-app-dev]
|
|
steps:
|
|
- name: Fail job if any needs failed
|
|
if: contains(needs.*.result, 'failure')
|
|
run: exit 1
|