chore: remove data-migration image (#4605)

This commit is contained in:
Matti Nannt
2025-01-15 19:32:51 +01:00
committed by GitHub
parent d3adc1629c
commit 21644f5ad8
3 changed files with 77 additions and 112 deletions

View File

@@ -1,71 +0,0 @@
name: Docker for Data Migrations
on:
workflow_dispatch:
push:
tags:
- "v*"
env:
REGISTRY: ghcr.io
IMAGE_NAME: formbricks/data-migrations
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/formbricks?schema=public"
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3.5.0
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=raw,value=${{ github.ref_name }}
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./packages/database/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
DATABASE_URL=${{ env.DATABASE_URL }}
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
run: |
cosign sign --yes ghcr.io/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
cosign sign --yes ghcr.io/${{ env.IMAGE_NAME }}:latest

View File

@@ -8,6 +8,82 @@ export const metadata = {
# Migration Guide
## v3.1
<Note>
We released a new automatic data migration approach with Formbricks 3.0. If you are on a version older than v2.7, you need to migrate step-by-step through the earlier versions first (e.g. 2.4 → 2.5 → 2.6 → 2.7). After you have reached v2.7, you can upgrade directly to any v3.x and future release without performing each intermediate migration.
</Note>
### Steps to Migrate
This guide is for users who are self-hosting Formbricks using our one-click setup. If you are using a different setup, you might adjust the commands accordingly.
To run all these steps, please navigate to the `formbricks` folder where your `docker-compose.yml` file is located.
1. **Backup your Database**: This is a crucial step. Please make sure to backup your database before proceeding with the upgrade. You can use the following command to backup your database:
<Col>
<CodeGroup title="Backup Postgres">
```bash
docker exec formbricks-postgres-1 pg_dump -Fc -U postgres -d formbricks > formbricks_pre_v3.1_$(date +%Y%m%d_%H%M%S).dump
```
</CodeGroup>
</Col>
<Note>
If you run into “No such container”, use `docker ps` to find your container name, e.g. `formbricks_postgres_1`.
</Note>
<Note>
If you prefer storing the backup as an `*.sql` file remove the `-Fc` (custom format) option. In case of a restore scenario you will need to use `psql` then with an empty `formbricks` database.
</Note>
2. Pull the latest version of Formbricks:
<Col>
<CodeGroup title="Stop the containers">
```bash
docker compose pull
```
</CodeGroup>
</Col>
3. Stop the running Formbricks instance & remove the related containers:
<Col>
<CodeGroup title="Stop the containers">
```bash
docker compose down
```
</CodeGroup>
</Col>
4. Restarting the containers with the latest version of Formbricks:
<Col>
<CodeGroup title="Restart the containers">
```bash
docker compose up -d
```
</CodeGroup>
</Col>
When you start the latest version of Formbricks, it will automatically detect and run any necessary data migrations during startup. There is no need to run any manual migration steps or pull any separate migration images.
5. Access your updated instance
Once the containers are up and running, simply navigate to the same URL as before to access your fully migrated Formbricks instance.
Thats it! The new workflow ensures that your Formbricks instance will always remain up-to-date with the latest schema changes as soon as you run the updated container.
## v3.0
<Note>
@@ -89,9 +165,7 @@ When you start the latest version of Formbricks, it will automatically detect an
5. Access your updated instance
Once the containers are up and running, simply navigate to the same URL as before to access your fully migrated Formbricks instance.
Thats it! The new workflow ensures that your Formbricks instance will always remain up-to-date with the latest schema changes as soon as you run the updated container.
Thats it! Once the containers are up and running, simply navigate to the same URL as before to access your fully migrated Formbricks instance.
## v2.7

View File

@@ -1,38 +0,0 @@
FROM node:22-alpine AS base
#
## step 1: Prune monorepo
#
FROM base AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN turbo prune @formbricks/database --docker
#
## step 2: Install & build
#
FROM base AS runner
WORKDIR /app
# Enable corepack and prepare pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
ARG UPGRADE_TO_VERSION
ENV UPGRADE_TO_VERSION=$UPGRADE_TO_VERSION
# Install necessary build tools and compilers
# RUN apk update && apk add --no-cache g++ cmake make gcc python3 openssl-dev
COPY --from=builder /app/out/full/ .
RUN pnpm install
CMD ["sh", "-c", "cd packages/database && pnpm data-migration:${UPGRADE_TO_VERSION}"]