Compare commits
2 Commits
456658a96c
...
76edbf0624
Author | SHA1 | Date | |
---|---|---|---|
76edbf0624 | |||
280a013c48 |
14
.github/actions/setup-docker-environment/action.yml
vendored
Normal file
14
.github/actions/setup-docker-environment/action.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name: "Setup Docker Environment"
|
||||||
|
description: "Common steps for setting up Docker build environment (checkout, QEMU, and Buildx)"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3.4.0
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3.9.0
|
27
.github/workflows/feature-pr-build.yml
vendored
Normal file
27
.github/workflows/feature-pr-build.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: Build Docker Image for Pull Request
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository actions
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Docker Environment
|
||||||
|
uses: ./.github/actions/setup-docker-environment
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
uses: docker/build-push-action@v6.13.0
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: false
|
||||||
|
tags: ${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.event.pull_request.number }}
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
36
.github/workflows/main.yml
vendored
Normal file
36
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY_URL: gitea.kobim.cloud
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository actions
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Docker Environment
|
||||||
|
uses: ./.github/actions/setup-docker-environment
|
||||||
|
|
||||||
|
- name: Log in to Docker registry
|
||||||
|
uses: docker/login-action@v3.3.0
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY_URL }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v6.13.0
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REGISTRY_URL }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
5
server/.env.example
Normal file
5
server/.env.example
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# MongoDB Environment
|
||||||
|
MONGO_INITDB_ROOT_USERNAME=root
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD=password
|
||||||
|
MONGO_EXPRESS_USERNAME=admin
|
||||||
|
MONGO_EXPRESS_PASSWORD=password
|
49
server/docker-compose.yml
Normal file
49
server/docker-compose.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
services:
|
||||||
|
mongodb:
|
||||||
|
image: mongo:latest
|
||||||
|
container_name: mongodb
|
||||||
|
hostname: mongodb
|
||||||
|
volumes:
|
||||||
|
- ./mongodb/initdb.d/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
|
||||||
|
- mongodb-data:/data/db/
|
||||||
|
- mongodb-log:/var/log/mongodb/
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
|
||||||
|
ports:
|
||||||
|
- "27017:27017"
|
||||||
|
networks:
|
||||||
|
- mongodb_network
|
||||||
|
|
||||||
|
mongo-express:
|
||||||
|
image: mongo-express:latest
|
||||||
|
container_name: mongo-express
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGO_INITDB_ROOT_USERNAME}
|
||||||
|
ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
|
||||||
|
ME_CONFIG_MONGODB_PORT: 27017
|
||||||
|
ME_CONFIG_MONGODB_SERVER: 'mongodb'
|
||||||
|
ME_CONFIG_BASICAUTH_USERNAME: ${MONGO_EXPRESS_USERNAME}
|
||||||
|
ME_CONFIG_BASICAUTH_PASSWORD: ${MONGO_EXPRESS_PASSWORD}
|
||||||
|
ports:
|
||||||
|
- 8081:8081
|
||||||
|
networks:
|
||||||
|
- mongodb_network
|
||||||
|
depends_on:
|
||||||
|
- mongodb
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mongodb-data:
|
||||||
|
driver: local
|
||||||
|
name: mongo-data
|
||||||
|
mongodb-log:
|
||||||
|
driver: local
|
||||||
|
name: mongo-log
|
||||||
|
|
||||||
|
networks:
|
||||||
|
mongodb_network:
|
||||||
|
driver: bridge
|
||||||
|
name: mongo-network
|
33
server/mongodb/initdb.d/mongo-init.js
Normal file
33
server/mongodb/initdb.d/mongo-init.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
db = db.getSiblingDB("statistics");
|
||||||
|
|
||||||
|
db.createRole({
|
||||||
|
role: "statsReadWrite",
|
||||||
|
privileges: [
|
||||||
|
{
|
||||||
|
resource: {
|
||||||
|
db: "statistics",
|
||||||
|
collection: "peertube",
|
||||||
|
},
|
||||||
|
actions: ["insert"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
roles: [
|
||||||
|
{
|
||||||
|
role: "read",
|
||||||
|
db: "statistics",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
db.createUser({
|
||||||
|
user: "stats_user",
|
||||||
|
pwd: "@z^VFhN7q%vzit",
|
||||||
|
roles: [
|
||||||
|
{
|
||||||
|
role: 'statsReadWrite',
|
||||||
|
db: 'statistics',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
db.createCollection("peertube");
|
Reference in New Issue
Block a user