mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
commit
148eaefc0e
7 changed files with 71 additions and 124 deletions
58
.github/workflows/cd-manual.yml
vendored
58
.github/workflows/cd-manual.yml
vendored
|
|
@ -1,58 +0,0 @@
|
||||||
name: Create docker images (manual)
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
type: string
|
|
||||||
description: Version
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build, push, and deploy
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
db-type: [postgresql]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Extract version parts from input
|
|
||||||
id: extract_version
|
|
||||||
run: |
|
|
||||||
echo "version=$(echo ${{ github.event.inputs.version }})" >> $GITHUB_ENV
|
|
||||||
echo "major=$(echo ${{ github.event.inputs.version }} | cut -d. -f1)" >> $GITHUB_ENV
|
|
||||||
echo "minor=$(echo ${{ github.event.inputs.version }} | cut -d. -f2)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Generate tags
|
|
||||||
id: generate_tags
|
|
||||||
run: |
|
|
||||||
echo "tag_major=$(echo ${{ matrix.db-type }}-${{ env.major }})" >> $GITHUB_ENV
|
|
||||||
echo "tag_minor=$(echo ${{ matrix.db-type }}-${{ env.major }}.${{ env.minor }})" >> $GITHUB_ENV
|
|
||||||
echo "tag_patch=$(echo ${{ matrix.db-type }}-${{ env.version }})" >> $GITHUB_ENV
|
|
||||||
echo "tag_latest=$(echo ${{ matrix.db-type }}-latest)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- uses: mr-smithers-excellent/docker-build-push@v6
|
|
||||||
name: Build & push Docker image to ghcr.io for ${{ matrix.db-type }}
|
|
||||||
with:
|
|
||||||
image: umami
|
|
||||||
tags: ${{ env.tag_major }}, ${{ env.tag_minor }}, ${{ env.tag_patch }}, ${{ env.tag_latest }}
|
|
||||||
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
|
|
||||||
registry: ghcr.io
|
|
||||||
multiPlatform: true
|
|
||||||
platform: linux/amd64,linux/arm64
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- uses: mr-smithers-excellent/docker-build-push@v6
|
|
||||||
name: Build & push Docker image to docker.io for ${{ matrix.db-type }}
|
|
||||||
with:
|
|
||||||
image: umamisoftware/umami
|
|
||||||
tags: ${{ env.tag_major }}, ${{ env.tag_minor }}, ${{ env.tag_patch }}, ${{ env.tag_latest }}
|
|
||||||
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
|
|
||||||
registry: docker.io
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
75
.github/workflows/cd.yml
vendored
75
.github/workflows/cd.yml
vendored
|
|
@ -5,6 +5,11 @@ on:
|
||||||
tags:
|
tags:
|
||||||
- 'v*.*.*'
|
- 'v*.*.*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: 'Optional image version (e.g. 3.0.0, v3.0.0, or 3.0.0-beta.1)'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
@ -15,20 +20,22 @@ jobs:
|
||||||
packages: write
|
packages: write
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
db-type: [postgresql]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
# Install cosign (for image signing)
|
|
||||||
- name: Install cosign
|
- name: Install cosign
|
||||||
uses: sigstore/cosign-installer@v3
|
uses: sigstore/cosign-installer@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log into GHCR
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Log into Docker Hub
|
- name: Log into Docker Hub
|
||||||
if: github.repository == 'umami-software/umami'
|
if: github.repository == 'umami-software/umami'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
|
@ -37,12 +44,28 @@ jobs:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Log into GHCR
|
# Compute tags for the image
|
||||||
uses: docker/login-action@v3
|
- name: Compute version tags
|
||||||
with:
|
id: compute
|
||||||
registry: ghcr.io
|
run: |
|
||||||
username: ${{ github.actor }}
|
INPUT="${{ github.event.inputs.version }}"
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
TAGS=""
|
||||||
|
|
||||||
|
if [[ -n "$INPUT" ]]; then
|
||||||
|
VERSION="${INPUT#v}" # strip leading v
|
||||||
|
MAJOR=$(echo "$VERSION" | cut -d. -f1)
|
||||||
|
MINOR=$(echo "$VERSION" | cut -d. -f2)
|
||||||
|
|
||||||
|
# prereleases (e.g., 3.0.0-beta) do NOT get 'latest'
|
||||||
|
if [[ "$VERSION" == *-* ]]; then
|
||||||
|
TAGS="${VERSION}"
|
||||||
|
else
|
||||||
|
TAGS="${VERSION},${MAJOR}.${MINOR},${MAJOR},latest"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "tags=$TAGS" >> $GITHUB_OUTPUT
|
||||||
|
echo "Computed tags: $TAGS"
|
||||||
|
|
||||||
- name: Extract Docker metadata
|
- name: Extract Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
|
|
@ -51,30 +74,32 @@ jobs:
|
||||||
images: |
|
images: |
|
||||||
umamisoftware/umami,enable=${{ github.repository == 'umami-software/umami' }}
|
umamisoftware/umami,enable=${{ github.repository == 'umami-software/umami' }}
|
||||||
ghcr.io/${{ github.repository }}
|
ghcr.io/${{ github.repository }}
|
||||||
flavor: |
|
|
||||||
latest=auto
|
|
||||||
prefix=${{ matrix.db-type }}-
|
|
||||||
tags: |
|
tags: |
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }}
|
||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }}
|
||||||
|
type=raw,value=${{ steps.compute.outputs.tags }},enable=${{ steps.compute.outputs.tags != '' }}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=sha
|
||||||
|
|
||||||
|
# Build and push images
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: build-and-push
|
id: build-and-push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
build-args: DATABASE_TYPE=${{ matrix.db-type }}
|
|
||||||
push: true
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
provenance: false # disable automatic registry attestations
|
||||||
|
|
||||||
# Sign the published image digest
|
# Generate a local provenance attestation (not uploaded)
|
||||||
- name: Sign the published Docker image
|
- name: Generate local provenance attestation
|
||||||
env:
|
run: |
|
||||||
TAGS: ${{ steps.meta.outputs.tags }}
|
cosign attest --yes \
|
||||||
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
--predicate <(echo '{"build":"github-actions","repo":"${{ github.repository }}","run_id":"${{ github.run_id }}"}') \
|
||||||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes "{}@${DIGEST}"
|
--type slsaprovenance \
|
||||||
|
${{ steps.meta.outputs.tags }}
|
||||||
|
|
|
||||||
22
.github/workflows/delete-untagged-images.yml
vendored
22
.github/workflows/delete-untagged-images.yml
vendored
|
|
@ -1,22 +0,0 @@
|
||||||
name: Delete untagged GHCR images
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch: # Run manually from the Actions tab
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
cleanup:
|
|
||||||
name: Delete all untagged images
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
packages: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Delete untagged GHCR images
|
|
||||||
uses: actions/delete-package-versions@v5
|
|
||||||
with:
|
|
||||||
package-name: "umami" # 👈 change if your GHCR package name differs
|
|
||||||
package-type: "container"
|
|
||||||
delete-only-untagged-versions: true
|
|
||||||
min-versions-to-keep: 0
|
|
||||||
|
|
@ -89,7 +89,7 @@ docker compose up -d
|
||||||
Alternatively, to pull just the Umami Docker image with PostgreSQL support:
|
Alternatively, to pull just the Umami Docker image with PostgreSQL support:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker pull docker.umami.is/umami-software/umami:postgresql-latest
|
docker pull docker.umami.is/umami-software/umami:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
services:
|
services:
|
||||||
umami:
|
umami:
|
||||||
image: ghcr.io/umami-software/umami:postgresql-latest
|
image: ghcr.io/umami-software/umami:latest
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { useEffect, useCallback, useState } from 'react';
|
import { useEffect, useCallback, useState } from 'react';
|
||||||
import { Button, AlertBanner, Flexbox } from '@umami/react-zen';
|
import { Button, AlertBanner, Column, Row } from '@umami/react-zen';
|
||||||
import { setItem } from '@/lib/storage';
|
import { setItem } from '@/lib/storage';
|
||||||
import { useVersion, checkVersion } from '@/store/version';
|
import { useVersion, checkVersion } from '@/store/version';
|
||||||
import { REPO_URL, VERSION_CHECK } from '@/lib/constants';
|
import { REPO_URL, VERSION_CHECK } from '@/lib/constants';
|
||||||
|
|
@ -47,13 +47,15 @@ export function UpdateNotice({ user, config }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flexbox justifyContent="space-between" alignItems="center">
|
<Column justifyContent="center" alignItems="center" position="fixed" top="10px" width="100%">
|
||||||
<AlertBanner title={formatMessage(messages.newVersionAvailable, { version: `v${latest}` })}>
|
<Row width="600px">
|
||||||
<Button variant="primary" onPress={handleViewClick}>
|
<AlertBanner title={formatMessage(messages.newVersionAvailable, { version: `v${latest}` })}>
|
||||||
{formatMessage(labels.viewDetails)}
|
<Button variant="primary" onPress={handleViewClick}>
|
||||||
</Button>
|
{formatMessage(labels.viewDetails)}
|
||||||
<Button onPress={handleDismissClick}>{formatMessage(labels.dismiss)}</Button>
|
</Button>
|
||||||
</AlertBanner>
|
<Button onPress={handleDismissClick}>{formatMessage(labels.dismiss)}</Button>
|
||||||
</Flexbox>
|
</AlertBanner>
|
||||||
|
</Row>
|
||||||
|
</Column>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as detect from '../detect';
|
import { getIpAddress } from '../ip';
|
||||||
|
|
||||||
const IP = '127.0.0.1';
|
const IP = '127.0.0.1';
|
||||||
const BAD_IP = '127.127.127.127';
|
const BAD_IP = '127.127.127.127';
|
||||||
|
|
@ -6,23 +6,23 @@ const BAD_IP = '127.127.127.127';
|
||||||
test('getIpAddress: Custom header', () => {
|
test('getIpAddress: Custom header', () => {
|
||||||
process.env.CLIENT_IP_HEADER = 'x-custom-ip-header';
|
process.env.CLIENT_IP_HEADER = 'x-custom-ip-header';
|
||||||
|
|
||||||
expect(detect.getIpAddress(new Headers({ 'x-custom-ip-header': IP }))).toEqual(IP);
|
expect(getIpAddress(new Headers({ 'x-custom-ip-header': IP }))).toEqual(IP);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getIpAddress: CloudFlare header', () => {
|
test('getIpAddress: CloudFlare header', () => {
|
||||||
expect(detect.getIpAddress(new Headers({ 'cf-connecting-ip': IP }))).toEqual(IP);
|
expect(getIpAddress(new Headers({ 'cf-connecting-ip': IP }))).toEqual(IP);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getIpAddress: Standard header', () => {
|
test('getIpAddress: Standard header', () => {
|
||||||
expect(detect.getIpAddress(new Headers({ 'x-forwarded-for': IP }))).toEqual(IP);
|
expect(getIpAddress(new Headers({ 'x-forwarded-for': IP }))).toEqual(IP);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getIpAddress: CloudFlare header is lower priority than standard header', () => {
|
test('getIpAddress: CloudFlare header is lower priority than standard header', () => {
|
||||||
expect(
|
expect(getIpAddress(new Headers({ 'cf-connecting-ip': BAD_IP, 'x-forwarded-for': IP }))).toEqual(
|
||||||
detect.getIpAddress(new Headers({ 'cf-connecting-ip': BAD_IP, 'x-forwarded-for': IP })),
|
IP,
|
||||||
).toEqual(IP);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getIpAddress: No header', () => {
|
test('getIpAddress: No header', () => {
|
||||||
expect(detect.getIpAddress(new Headers())).toEqual(null);
|
expect(getIpAddress(new Headers())).toEqual(null);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue