-
Notifications
You must be signed in to change notification settings - Fork 97
dev compose setup #1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
dev compose setup #1007
Changes from all commits
1488c6f
8c0f6d7
0f9918e
468a426
9aaaa7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| name: Docker publish | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| name: Build and push Docker images | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Determine tags | ||
| id: tags | ||
| run: | | ||
| DEFAULT_BRANCH="${{ github.event.repository.default_branch }}" | ||
| CURRENT_BRANCH="${{ github.ref_name }}" | ||
|
|
||
| if [ "$CURRENT_BRANCH" = "$DEFAULT_BRANCH" ]; then | ||
| NUMBER="${{ github.run_number }}" | ||
| else | ||
| NUMBER="$(git rev-parse --short=10 HEAD)" | ||
| fi | ||
| REPOSITORY="${{ github.repository }}" | ||
| REGISTRY="ghcr.io/${REPOSITORY,,,}" | ||
|
|
||
| if [ "$CURRENT_BRANCH" = "$DEFAULT_BRANCH" ]; then | ||
| echo "release_tags=${REGISTRY}:build-${NUMBER}-release,${REGISTRY}:latest-release" >> "$GITHUB_OUTPUT" | ||
| echo "dev_tags=${REGISTRY}:build-${NUMBER}-dev,${REGISTRY}:latest-dev" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "release_tags=${REGISTRY}:git-${NUMBER}-release" >> "$GITHUB_OUTPUT" | ||
| echo "dev_tags=${REGISTRY}:git-${NUMBER}-dev" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's this github token? Where does that live?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is autopopulated by github in actions/workflows, no need to set it up in any way. |
||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push release image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: Dockerfile | ||
| target: runner | ||
| push: true | ||
| tags: ${{ steps.tags.outputs.release_tags }} | ||
| cache-from: type=gha,scope=docker | ||
| cache-to: type=gha,mode=max,scope=docker | ||
|
|
||
| - name: Build and push dev image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: Dockerfile | ||
| target: dev | ||
| push: true | ||
| tags: ${{ steps.tags.outputs.dev_tags }} | ||
| cache-from: type=gha,scope=docker | ||
| cache-to: type=gha,mode=max,scope=docker | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is missing vmagent, to actually scrape and store the metrics in victoriametrics.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is using the built in scraper from victoriametrics (check line 40 and the prometheus.yml file), i can use the metrics in grafana just fine |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| name: teiserver-dev | ||
| services: | ||
| db: | ||
| image: postgres:18 | ||
| restart: unless-stopped | ||
| environment: | ||
| POSTGRES_PASSWORD: 123456789 | ||
| ports: | ||
| - "5432:5432" | ||
| volumes: | ||
| - teiserver_postgres_data:/var/lib/postgresql | ||
| - ./docker/postgres/init:/docker-entrypoint-initdb.d:ro | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
| interval: 5s | ||
| timeout: 3s | ||
| retries: 20 | ||
|
|
||
| mailhog: | ||
| image: mailhog/mailhog:v1.0.1 | ||
| restart: unless-stopped | ||
| ports: | ||
| - "1025:1025" # SMTP | ||
| - "8025:8025" # Web UI | ||
|
|
||
| victoriametrics: | ||
| image: victoriametrics/victoria-metrics:v1.136.0 | ||
| restart: unless-stopped | ||
| ports: | ||
| - "8428:8428" | ||
| volumes: | ||
| - teiserver_victoriametrics_data:/victoria-metrics-data | ||
| - ./docker/victoriametrics/prometheus.yml:/etc/prometheus/prometheus.yml:ro | ||
| command: | ||
| - "-retentionPeriod=14d" | ||
| - "-httpListenAddr=:8428" | ||
| - "-promscrape.config=/etc/prometheus/prometheus.yml" | ||
|
|
||
| grafana: | ||
| image: grafana/grafana:main | ||
| container_name: teiserver-grafana | ||
| restart: unless-stopped | ||
| depends_on: | ||
| - victoriametrics | ||
| environment: | ||
| GF_SECURITY_ADMIN_USER: admin | ||
| GF_SECURITY_ADMIN_PASSWORD: admin | ||
| GF_USERS_ALLOW_SIGN_UP: "false" | ||
| GF_INSTALL_PLUGINS: "" | ||
| ports: | ||
| - "3000:3000" | ||
| volumes: | ||
| - teiserver_grafana_data:/var/lib/grafana | ||
| - ./docker/grafana/provisioning:/etc/grafana/provisioning:ro | ||
|
|
||
| teiserver: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile | ||
| target: dev | ||
| container_name: teiserver | ||
| depends_on: | ||
| db: | ||
| condition: service_healthy | ||
| environment: | ||
| # Database | ||
| TEI_DB_HOSTNAME: "db" | ||
| TEI_DB_USERNAME: "teiserver_dev" | ||
| TEI_DB_PASSWORD: "123456789" | ||
| TEI_DB_NAME: "teiserver_dev" | ||
|
|
||
| # Application | ||
| SECRET_KEY_BASE: "dev_secret_key_base_change_in_production_min_64_chars_long_string" | ||
| TEI_OAUTH_ISSUER: ${TEI_OAUTH_ISSUER:-http://localhost:4000} | ||
| TEI_DOMAIN_NAME: ${TEI_DOMAIN_NAME:-localhost} | ||
|
|
||
| # Email integration (MailHog) | ||
| TEI_ENABLE_EMAIL_INTEGRATION: "true" | ||
| TEI_SMTP_SERVER: "mailhog" | ||
| TEI_SMTP_HOSTNAME: "localhost" | ||
| TEI_SMTP_PORT: "1025" | ||
| TEI_SMTP_TLS: "never" | ||
| TEI_SMTP_TLS_VERIFY: "false" | ||
| TEI_SMTP_AUTH: "never" | ||
|
|
||
| # Dev settings | ||
| GENERATE_FAKE_DATA: "true" | ||
| IN_DOCKER: "true" | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "curl -f http://localhost:4000 || exit 1"] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 10 | ||
| start_period: 90s | ||
| ports: | ||
| - "4000:4000" # HTTP | ||
| - "4001:4001" # HTTP Metrics | ||
| - "8200:8200" # Spring protocol | ||
| - "8201:8201" # Spring protocol | ||
| - "8202:8202" # Spring protocol | ||
| volumes: | ||
| # Mount source code for live reload, might cause issues on Windows. | ||
| # If you run into performance issues, remove these mounts. | ||
| - ./lib:/build/lib | ||
| - ./config:/build/config | ||
| - ./priv:/build/priv | ||
| - ./assets:/build/assets | ||
| - ./test:/build/test | ||
| stdin_open: true | ||
| tty: true | ||
|
|
||
| volumes: | ||
| teiserver_postgres_data: | ||
| teiserver_victoriametrics_data: | ||
| teiserver_grafana_data: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| apiVersion: 1 | ||
|
|
||
| datasources: | ||
| - name: VictoriaMetrics | ||
| type: prometheus | ||
| access: proxy | ||
| url: http://victoriametrics:8428 | ||
| isDefault: true | ||
| editable: true | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| CREATE ROLE teiserver_dev LOGIN PASSWORD '123456789' SUPERUSER; | ||
| CREATE ROLE teiserver_test LOGIN PASSWORD '123456789' SUPERUSER; | ||
|
|
||
| CREATE DATABASE teiserver_dev OWNER teiserver_dev; | ||
| CREATE DATABASE teiserver_test OWNER teiserver_test; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you want to push dev images? I would drop the entire thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for bar-lobby so you can run one command and have a working setup.