-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: deploy-plausible | ||
|
||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/plausible.yml' | ||
- 'plausible/**' | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: Plausible | ||
url: https://pa.aosus.org | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Tailscale | ||
uses: tailscale/github-action@7a0b30ed3517c2244d1330e39467b95f067a33bd | ||
with: | ||
oauth-client-id: ${{ secrets.TAILSCALE_CLIENT_ID }} | ||
oauth-secret: ${{ secrets.TAILSCALE_SECRET }} | ||
tags: tag:deploy-ci | ||
hostname: Github-actions | ||
version: ${{ vars.TAILSCALE_VERSION }} | ||
|
||
- name: Add secrets to compose | ||
env: | ||
SECRET_KEY_BASE: ${{ secrets.plausible_secret_key_base }} | ||
TOTP_VAULT_KEY: ${{ secrets.plausible_totp_vault_key }} | ||
SMTP_USER_PWD: ${{ secrets.plausible_smtp_user_pwd }} | ||
GOOGLE_CLIENT_ID: ${{ secrets.plausible_google_client_id }} | ||
GOOGLE_CLIENT_SECRET: ${{ secrets.plausible_google_client_secret }} | ||
POSTGRES_PASSWORD: ${{ secrets.plausible_postgres_password }} | ||
MAXMIND_LICENSE_KEY: ${{ secrets.plausible_maxmind_license_key }} | ||
run: | | ||
sed -i "s|(plausible_secret_key_base)|$SECRET_KEY_BASE|g" $GITHUB_WORKSPACE/plausible/docker-compose.yml | ||
sed -i "s|(plausible_totp_vault_key)|$TOTP_VAULT_KEY|g" $GITHUB_WORKSPACE/plausible/docker-compose.yml | ||
sed -i "s|(plausible_smtp_user_pwd)|$SMTP_USER_PWD|g" $GITHUB_WORKSPACE/plausible/docker-compose.yml | ||
sed -i "s|(plausible_google_client_id)|$GOOGLE_CLIENT_ID|g" $GITHUB_WORKSPACE/plausible/docker-compose.yml | ||
sed -i "s|(plausible_google_client_secret)|$GOOGLE_CLIENT_SECRET|g" $GITHUB_WORKSPACE/plausible/docker-compose.yml | ||
sed -i "s|(plausible_postgres_password)|$POSTGRES_PASSWORD|g" $GITHUB_WORKSPACE/plausible/docker-compose.yml | ||
sed -i "s|(plausible_maxmind_license_key)|$MAXMIND_LICENSE_KEY|g" $GITHUB_WORKSPACE/plausible/docker-compose.yml | ||
- name: Start Deployment | ||
uses: FarisZR/docker-compose-gitops-action@v1.0.1 | ||
with: | ||
remote_docker_host: ${{ secrets.server_address }} | ||
tailscale_ssh: true # no need for manual private and public keys | ||
compose_file_path: plausible/docker-compose.yml | ||
args: -p plausible up -d --remove-orphans | ||
upload_directory: true | ||
docker_compose_directory: plausible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<clickhouse> | ||
<logger> | ||
<level>warning</level> | ||
<console>true</console> | ||
</logger> | ||
|
||
<!-- | ||
Avoid the warning: "Listen [::]:9009 failed: Address family for hostname not supported". | ||
If Docker has IPv6 disabled, bind ClickHouse to IPv4 to prevent this issue. | ||
Add this to the configuration to ensure it listens on all IPv4 interfaces: | ||
<listen_host>0.0.0.0</listen_host> | ||
--> | ||
|
||
<!-- Stop all the unnecessary logging --> | ||
<query_thread_log remove="remove"/> | ||
<query_log remove="remove"/> | ||
<text_log remove="remove"/> | ||
<trace_log remove="remove"/> | ||
<metric_log remove="remove"/> | ||
<asynchronous_metric_log remove="remove"/> | ||
<session_log remove="remove"/> | ||
<part_log remove="remove"/> | ||
</clickhouse> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<clickhouse> | ||
<profiles> | ||
<default> | ||
<log_queries>0</log_queries> | ||
<log_query_threads>0</log_query_threads> | ||
</default> | ||
</profiles> | ||
</clickhouse> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
networks: | ||
default: | ||
enable_ipv6: true | ||
web: | ||
external: true | ||
|
||
services: | ||
plausible_db: | ||
restart: unless-stopped | ||
image: postgres:16.4-alpine@sha256:d898b0b78a2627cb4ee63464a14efc9d296884f1b28c841b0ab7d7c42f1fffdf | ||
volumes: | ||
- /home/aosus/plausible/postgres:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_PASSWORD=(plausible_postgres_password) | ||
|
||
plausible_events_db: | ||
restart: unless-stopped | ||
image: clickhouse/clickhouse-server:24.3.3.102-alpine | ||
volumes: | ||
- /home/aosus/plausible/event-data:/var/lib/clickhouse | ||
configs: | ||
- source: clickhouse-config | ||
target: /etc/clickhouse-server/config.d/logging.xml | ||
- source: clickhouse-user-config | ||
target: /etc/clickhouse-server/users.d/logging.xml | ||
ulimits: | ||
nofile: | ||
soft: 262144 | ||
hard: 262144 | ||
|
||
plausible: | ||
restart: unless-stopped | ||
image: ghcr.io/plausible/community-edition:v2.1.4@sha256:59ffee982deb849a2749eef206005e475e688d59fa053858d75420d95cddb8e8 | ||
container_name: plausible | ||
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run" | ||
expose: | ||
- 8000 | ||
depends_on: | ||
- plausible_db | ||
- plausible_events_db | ||
# ports: | ||
# - 8004:8000 | ||
environment: | ||
- BASE_URL=https://pa.aosus.org | ||
- DISALBLE_REGISTRATION=true | ||
- MAILER_EMAIL=plausible@services.aosus.org | ||
- SMTP_HOST_ADDR=smtp.eu.mailgun.org | ||
- SMTP_HOST_PORT=587 | ||
- SMTP_USER_NAME=plausible@services.aosus.org | ||
- SECRET_KEY_BASE=(plausible_secret_key_base) | ||
- TOTP_VAULT_KEY=(plausible_totp_vault_key) | ||
- SMTP_USER_PWD=(plausible_smtp_user_pwd) | ||
- MAILER_ADAPTER=Bamboo.Mua | ||
- GOOGLE_CLIENT_ID=(plausible_google_client_id) | ||
- GOOGLE_CLIENT_SECRET=(plausible_google_client_secret) | ||
- MAXMIND_LICENSE_KEY=(plausible_maxmind_license_key) | ||
- MAXMIND_EDITION=GeoLite2-City | ||
networks: | ||
default: | ||
web: | ||
|
||
volumes: | ||
geoip: | ||
driver: local | ||
|
||
configs: | ||
clickhouse-config: | ||
file: /home/aosus/plausible/clickhouse-config.xml | ||
clickhouse-user-config: | ||
file: /home/aosus/plausible/clickhouse-user-config.xml |