Moved to _dev

This commit is contained in:
2025-09-20 16:11:47 +02:00
parent fb1a8753b7
commit b2ba11fcd3
1670 changed files with 224899 additions and 0 deletions

138
appwrite/compose.env Normal file
View File

@@ -0,0 +1,138 @@
_APP_ENV=production
_APP_LOCALE=en
_APP_OPTIONS_ABUSE=enabled
_APP_OPTIONS_FORCE_HTTPS=disabled
_APP_OPTIONS_FUNCTIONS_FORCE_HTTPS=disabled
_APP_OPTIONS_ROUTER_FORCE_HTTPS=disabled
_APP_OPTIONS_ROUTER_PROTECTION=disabled
_APP_OPENSSL_KEY_V1=7b9983b6b031a2291255fcb9e6d1eb85
_APP_DOMAIN=localhost
_APP_CUSTOM_DOMAIN_DENY_LIST=example.com,test.com,app.example.com
_APP_DOMAIN_FUNCTIONS=functions.localhost
_APP_DOMAIN_SITES=sites.localhost
_APP_DOMAIN_TARGET=localhost
_APP_DOMAIN_TARGET_CNAME=localhost
_APP_DOMAIN_TARGET_AAAA=::1
_APP_DOMAIN_TARGET_A=127.0.0.1
_APP_CONSOLE_WHITELIST_ROOT=enabled
_APP_CONSOLE_WHITELIST_EMAILS=
_APP_CONSOLE_WHITELIST_IPS=
_APP_CONSOLE_HOSTNAMES=
_APP_SYSTEM_EMAIL_NAME=Appwrite
_APP_SYSTEM_EMAIL_ADDRESS=noreply@delmar.bzh
_APP_SYSTEM_TEAM_EMAIL=team@delmar.bzh
_APP_SYSTEM_RESPONSE_FORMAT=
_APP_SYSTEM_SECURITY_EMAIL_ADDRESS=certs@delmar.bzh
_APP_EMAIL_SECURITY=
_APP_EMAIL_CERTIFICATES=admin@delmar.bzh
_APP_USAGE_STATS=enabled
_APP_LOGGING_PROVIDER=
_APP_LOGGING_CONFIG=
_APP_USAGE_AGGREGATION_INTERVAL=30
_APP_USAGE_TIMESERIES_INTERVAL=30
_APP_USAGE_DATABASE_INTERVAL=900
_APP_WORKER_PER_CORE=6
_APP_CONSOLE_SESSION_ALERTS=disabled
_APP_COMPRESSION_ENABLED=enabled
_APP_COMPRESSION_MIN_SIZE_BYTES=1024
_APP_REDIS_HOST=redis
_APP_REDIS_PORT=6379
_APP_REDIS_USER=
_APP_REDIS_PASS=
_APP_DB_HOST=mariadb
_APP_DB_PORT=3306
_APP_DB_SCHEMA=appwrite
_APP_DB_USER=user
_APP_DB_PASS=password
_APP_DB_ROOT_PASS=rootsecretpassword
_APP_INFLUXDB_HOST=influxdb
_APP_INFLUXDB_PORT=8086
_APP_STATSD_HOST=telegraf
_APP_STATSD_PORT=8125
_APP_SMTP_HOST=pro1.mail.ovh.net
_APP_SMTP_PORT=587
_APP_SMTP_SECURE=tls
_APP_SMTP_USERNAME=admin@delmar.bzh
_APP_SMTP_PASSWORD=sxS4GA8rBfmFkCFL
_APP_SMS_PROVIDER=
_APP_SMS_FROM=
_APP_STORAGE_LIMIT=30000000
_APP_STORAGE_PREVIEW_LIMIT=20000000
_APP_STORAGE_ANTIVIRUS=disabled
_APP_STORAGE_ANTIVIRUS_HOST=clamav
_APP_STORAGE_ANTIVIRUS_PORT=3310
_APP_STORAGE_DEVICE=local
_APP_STORAGE_S3_ACCESS_KEY=
_APP_STORAGE_S3_SECRET=
_APP_STORAGE_S3_REGION=us-east-1
_APP_STORAGE_S3_BUCKET=
_APP_STORAGE_S3_ENDPOINT=
_APP_STORAGE_DO_SPACES_ACCESS_KEY=
_APP_STORAGE_DO_SPACES_SECRET=
_APP_STORAGE_DO_SPACES_REGION=us-east-1
_APP_STORAGE_DO_SPACES_BUCKET=
_APP_STORAGE_BACKBLAZE_ACCESS_KEY=
_APP_STORAGE_BACKBLAZE_SECRET=
_APP_STORAGE_BACKBLAZE_REGION=us-west-004
_APP_STORAGE_BACKBLAZE_BUCKET=
_APP_STORAGE_LINODE_ACCESS_KEY=
_APP_STORAGE_LINODE_SECRET=
_APP_STORAGE_LINODE_REGION=eu-central-1
_APP_STORAGE_LINODE_BUCKET=
_APP_STORAGE_WASABI_ACCESS_KEY=
_APP_STORAGE_WASABI_SECRET=
_APP_STORAGE_WASABI_REGION=eu-central-1
_APP_STORAGE_WASABI_BUCKET=
_APP_FUNCTIONS_SIZE_LIMIT=30000000
_APP_COMPUTE_SIZE_LIMIT=30000000
_APP_FUNCTIONS_BUILD_SIZE_LIMIT=2000000000
_APP_FUNCTIONS_TIMEOUT=900
_APP_FUNCTIONS_BUILD_TIMEOUT=900
_APP_COMPUTE_BUILD_TIMEOUT=900
_APP_FUNCTIONS_CONTAINERS=10
_APP_FUNCTIONS_CPUS=0
_APP_COMPUTE_CPUS=0
_APP_FUNCTIONS_MEMORY=0
_APP_COMPUTE_MEMORY=0
_APP_FUNCTIONS_MEMORY_SWAP=0
_APP_FUNCTIONS_RUNTIMES=node-16.0,php-8.0,python-3.9,ruby-3.0
_APP_EXECUTOR_SECRET=your-secret-key
_APP_EXECUTOR_HOST=http://exc1/v1
_APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes
_APP_FUNCTIONS_ENVS=node-16.0,php-7.4,python-3.9,ruby-3.0
_APP_FUNCTIONS_INACTIVE_THRESHOLD=60
_APP_COMPUTE_INACTIVE_THRESHOLD=60
DOCKERHUB_PULL_USERNAME=
DOCKERHUB_PULL_PASSWORD=
DOCKERHUB_PULL_EMAIL=
OPEN_RUNTIMES_NETWORK=appwrite_runtimes
_APP_FUNCTIONS_RUNTIMES_NETWORK=runtimes
_APP_COMPUTE_RUNTIMES_NETWORK=runtimes
_APP_DOCKER_HUB_USERNAME=
_APP_DOCKER_HUB_PASSWORD=
_APP_FUNCTIONS_MAINTENANCE_INTERVAL=3600
_APP_COMPUTE_MAINTENANCE_INTERVAL=3600
_APP_SITES_TIMEOUT=900
_APP_SITES_RUNTIMES=static-1,node-22,flutter-3.29
_APP_VCS_GITHUB_APP_NAME=
_APP_VCS_GITHUB_PRIVATE_KEY=
_APP_VCS_GITHUB_APP_ID=
_APP_VCS_GITHUB_CLIENT_ID=
_APP_VCS_GITHUB_CLIENT_SECRET=
_APP_VCS_GITHUB_WEBHOOK_SECRET=
_APP_MAINTENANCE_INTERVAL=86400
_APP_MAINTENANCE_DELAY=0
_APP_MAINTENANCE_START_TIME=00:00
_APP_MAINTENANCE_RETENTION_CACHE=2592000
_APP_MAINTENANCE_RETENTION_EXECUTION=1209600
_APP_MAINTENANCE_RETENTION_AUDIT=1209600
_APP_MAINTENANCE_RETENTION_AUDIT_CONSOLE=15778800
_APP_MAINTENANCE_RETENTION_ABUSE=86400
_APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000
_APP_MAINTENANCE_RETENTION_SCHEDULES=86400
_APP_GRAPHQL_MAX_BATCH_SIZE=10
_APP_GRAPHQL_MAX_COMPLEXITY=250
_APP_GRAPHQL_MAX_DEPTH=3
_APP_MIGRATIONS_FIREBASE_CLIENT_ID=
_APP_MIGRATIONS_FIREBASE_CLIENT_SECRET=
_APP_ASSISTANT_OPENAI_API_KEY=

View File

@@ -0,0 +1,965 @@
x-logging: &x-logging
logging:
driver: 'json-file'
options:
max-file: '5'
max-size: '10m'
services:
traefik:
image: traefik:2.11
container_name: appwrite-traefik
<<: *x-logging
command:
- --providers.file.directory=/storage/config
- --providers.file.watch=true
- --providers.docker=true
- --providers.docker.exposedByDefault=false
- --providers.docker.constraints=Label(`traefik.constraint-label-stack`,`appwrite`)
- --entrypoints.appwrite_web.address=:80
- --entrypoints.appwrite_websecure.address=:443
restart: unless-stopped
ports:
- 50154:80
- 50155:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- appwrite-config:/storage/config:ro
- appwrite-certificates:/storage/certificates:ro
depends_on:
- appwrite
networks:
- gateway
- appwrite
appwrite:
image: appwrite/appwrite:1.7.3
container_name: appwrite
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
labels:
- traefik.enable=true
- traefik.constraint-label-stack=appwrite
- traefik.docker.network=appwrite
- traefik.http.services.appwrite_api.loadbalancer.server.port=80
#http
- traefik.http.routers.appwrite_api_http.entrypoints=appwrite_web
- traefik.http.routers.appwrite_api_http.rule=PathPrefix(`/`)
- traefik.http.routers.appwrite_api_http.service=appwrite_api
# https
- traefik.http.routers.appwrite_api_https.entrypoints=appwrite_websecure
- traefik.http.routers.appwrite_api_https.rule=PathPrefix(`/`)
- traefik.http.routers.appwrite_api_https.service=appwrite_api
- traefik.http.routers.appwrite_api_https.tls=true
volumes:
- appwrite-uploads:/storage/uploads:rw
- appwrite-imports:/storage/imports:rw
- appwrite-cache:/storage/cache:rw
- appwrite-config:/storage/config:rw
- appwrite-certificates:/storage/certificates:rw
- appwrite-functions:/storage/functions:rw
- appwrite-sites:/storage/sites:rw
- appwrite-builds:/storage/builds:rw
depends_on:
- mariadb
- redis
# - clamav
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_LOCALE
- _APP_COMPRESSION_MIN_SIZE_BYTES
- _APP_CONSOLE_WHITELIST_ROOT
- _APP_CONSOLE_WHITELIST_EMAILS
- _APP_CONSOLE_SESSION_ALERTS
- _APP_CONSOLE_WHITELIST_IPS
- _APP_CONSOLE_HOSTNAMES
- _APP_SYSTEM_EMAIL_NAME
- _APP_SYSTEM_EMAIL_ADDRESS
- _APP_EMAIL_SECURITY
- _APP_SYSTEM_RESPONSE_FORMAT
- _APP_OPTIONS_ABUSE
- _APP_OPTIONS_ROUTER_PROTECTION
- _APP_OPTIONS_FORCE_HTTPS
- _APP_OPTIONS_ROUTER_FORCE_HTTPS
- _APP_OPENSSL_KEY_V1
- _APP_DOMAIN
- _APP_DOMAIN_TARGET_CNAME
- _APP_DOMAIN_TARGET_AAAA
- _APP_DOMAIN_TARGET_A
- _APP_DOMAIN_FUNCTIONS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_SMTP_HOST
- _APP_SMTP_PORT
- _APP_SMTP_SECURE
- _APP_SMTP_USERNAME
- _APP_SMTP_PASSWORD
- _APP_USAGE_STATS
- _APP_STORAGE_LIMIT
- _APP_STORAGE_PREVIEW_LIMIT
- _APP_STORAGE_ANTIVIRUS
- _APP_STORAGE_ANTIVIRUS_HOST
- _APP_STORAGE_ANTIVIRUS_PORT
- _APP_STORAGE_DEVICE
- _APP_STORAGE_S3_ACCESS_KEY
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
- _APP_STORAGE_DO_SPACES_BUCKET
- _APP_STORAGE_BACKBLAZE_ACCESS_KEY
- _APP_STORAGE_BACKBLAZE_SECRET
- _APP_STORAGE_BACKBLAZE_REGION
- _APP_STORAGE_BACKBLAZE_BUCKET
- _APP_STORAGE_LINODE_ACCESS_KEY
- _APP_STORAGE_LINODE_SECRET
- _APP_STORAGE_LINODE_REGION
- _APP_STORAGE_LINODE_BUCKET
- _APP_STORAGE_WASABI_ACCESS_KEY
- _APP_STORAGE_WASABI_SECRET
- _APP_STORAGE_WASABI_REGION
- _APP_STORAGE_WASABI_BUCKET
- _APP_COMPUTE_SIZE_LIMIT
- _APP_FUNCTIONS_TIMEOUT
- _APP_SITES_TIMEOUT
- _APP_COMPUTE_BUILD_TIMEOUT
- _APP_COMPUTE_CPUS
- _APP_COMPUTE_MEMORY
- _APP_FUNCTIONS_RUNTIMES
- _APP_SITES_RUNTIMES
- _APP_DOMAIN_SITES
- _APP_EXECUTOR_SECRET
- _APP_EXECUTOR_HOST
- _APP_LOGGING_CONFIG
- _APP_MAINTENANCE_INTERVAL
- _APP_MAINTENANCE_DELAY
- _APP_MAINTENANCE_START_TIME
- _APP_MAINTENANCE_RETENTION_EXECUTION
- _APP_MAINTENANCE_RETENTION_CACHE
- _APP_MAINTENANCE_RETENTION_ABUSE
- _APP_MAINTENANCE_RETENTION_AUDIT
- _APP_MAINTENANCE_RETENTION_AUDIT_CONSOLE
- _APP_MAINTENANCE_RETENTION_USAGE_HOURLY
- _APP_MAINTENANCE_RETENTION_SCHEDULES
- _APP_SMS_PROVIDER
- _APP_SMS_FROM
- _APP_GRAPHQL_MAX_BATCH_SIZE
- _APP_GRAPHQL_MAX_COMPLEXITY
- _APP_GRAPHQL_MAX_DEPTH
- _APP_VCS_GITHUB_APP_NAME
- _APP_VCS_GITHUB_PRIVATE_KEY
- _APP_VCS_GITHUB_APP_ID
- _APP_VCS_GITHUB_WEBHOOK_SECRET
- _APP_VCS_GITHUB_CLIENT_SECRET
- _APP_VCS_GITHUB_CLIENT_ID
- _APP_MIGRATIONS_FIREBASE_CLIENT_ID
- _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET
- _APP_ASSISTANT_OPENAI_API_KEY
appwrite-console:
<<: *x-logging
container_name: appwrite-console
image: appwrite/console:6.0.11
restart: unless-stopped
networks:
- appwrite
labels:
- "traefik.enable=true"
- "traefik.constraint-label-stack=appwrite"
- "traefik.docker.network=appwrite"
- "traefik.http.services.appwrite_console.loadbalancer.server.port=80"
#ws
- traefik.http.routers.appwrite_console_http.entrypoints=appwrite_web
- traefik.http.routers.appwrite_console_http.rule=PathPrefix(`/console`)
- traefik.http.routers.appwrite_console_http.service=appwrite_console
# wss
- traefik.http.routers.appwrite_console_https.entrypoints=appwrite_websecure
- traefik.http.routers.appwrite_console_https.rule=PathPrefix(`/console`)
- traefik.http.routers.appwrite_console_https.service=appwrite_console
- traefik.http.routers.appwrite_console_https.tls=true
appwrite-realtime:
image: appwrite/appwrite:1.7.3
entrypoint: realtime
container_name: appwrite-realtime
<<: *x-logging
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.constraint-label-stack=appwrite"
- "traefik.docker.network=appwrite"
- "traefik.http.services.appwrite_realtime.loadbalancer.server.port=80"
#ws
- traefik.http.routers.appwrite_realtime_ws.entrypoints=appwrite_web
- traefik.http.routers.appwrite_realtime_ws.rule=PathPrefix(`/v1/realtime`)
- traefik.http.routers.appwrite_realtime_ws.service=appwrite_realtime
# wss
- traefik.http.routers.appwrite_realtime_wss.entrypoints=appwrite_websecure
- traefik.http.routers.appwrite_realtime_wss.rule=PathPrefix(`/v1/realtime`)
- traefik.http.routers.appwrite_realtime_wss.service=appwrite_realtime
- traefik.http.routers.appwrite_realtime_wss.tls=true
networks:
- appwrite
depends_on:
- mariadb
- redis
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPTIONS_ABUSE
- _APP_OPTIONS_ROUTER_PROTECTION
- _APP_OPENSSL_KEY_V1
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_USAGE_STATS
- _APP_LOGGING_CONFIG
appwrite-worker-audits:
image: appwrite/appwrite:1.7.3
entrypoint: worker-audits
<<: *x-logging
container_name: appwrite-worker-audits
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_LOGGING_CONFIG
appwrite-worker-webhooks:
image: appwrite/appwrite:1.7.3
entrypoint: worker-webhooks
<<: *x-logging
container_name: appwrite-worker-webhooks
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_EMAIL_SECURITY
- _APP_SYSTEM_SECURITY_EMAIL_ADDRESS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_LOGGING_CONFIG
appwrite-worker-deletes:
image: appwrite/appwrite:1.7.3
entrypoint: worker-deletes
<<: *x-logging
container_name: appwrite-worker-deletes
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
volumes:
- appwrite-uploads:/storage/uploads:rw
- appwrite-cache:/storage/cache:rw
- appwrite-functions:/storage/functions:rw
- appwrite-sites:/storage/sites:rw
- appwrite-builds:/storage/builds:rw
- appwrite-certificates:/storage/certificates:rw
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_STORAGE_DEVICE
- _APP_STORAGE_S3_ACCESS_KEY
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
- _APP_STORAGE_DO_SPACES_BUCKET
- _APP_STORAGE_BACKBLAZE_ACCESS_KEY
- _APP_STORAGE_BACKBLAZE_SECRET
- _APP_STORAGE_BACKBLAZE_REGION
- _APP_STORAGE_BACKBLAZE_BUCKET
- _APP_STORAGE_LINODE_ACCESS_KEY
- _APP_STORAGE_LINODE_SECRET
- _APP_STORAGE_LINODE_REGION
- _APP_STORAGE_LINODE_BUCKET
- _APP_STORAGE_WASABI_ACCESS_KEY
- _APP_STORAGE_WASABI_SECRET
- _APP_STORAGE_WASABI_REGION
- _APP_STORAGE_WASABI_BUCKET
- _APP_LOGGING_CONFIG
- _APP_EXECUTOR_SECRET
- _APP_EXECUTOR_HOST
- _APP_MAINTENANCE_RETENTION_ABUSE
- _APP_MAINTENANCE_RETENTION_AUDIT
- _APP_MAINTENANCE_RETENTION_AUDIT_CONSOLE
- _APP_MAINTENANCE_RETENTION_EXECUTION
- _APP_SYSTEM_SECURITY_EMAIL_ADDRESS
- _APP_EMAIL_CERTIFICATES
appwrite-worker-databases:
image: appwrite/appwrite:1.7.3
entrypoint: worker-databases
<<: *x-logging
container_name: appwrite-worker-databases
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_LOGGING_CONFIG
appwrite-worker-builds:
image: appwrite/appwrite:1.7.3
entrypoint: worker-builds
<<: *x-logging
container_name: appwrite-worker-builds
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
volumes:
- appwrite-functions:/storage/functions:rw
- appwrite-sites:/storage/sites:rw
- appwrite-builds:/storage/builds:rw
- appwrite-uploads:/storage/uploads:rw
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_EXECUTOR_SECRET
- _APP_EXECUTOR_HOST
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_LOGGING_CONFIG
- _APP_VCS_GITHUB_APP_NAME
- _APP_VCS_GITHUB_PRIVATE_KEY
- _APP_VCS_GITHUB_APP_ID
- _APP_FUNCTIONS_TIMEOUT
- _APP_SITES_TIMEOUT
- _APP_COMPUTE_BUILD_TIMEOUT
- _APP_COMPUTE_CPUS
- _APP_COMPUTE_MEMORY
- _APP_COMPUTE_SIZE_LIMIT
- _APP_OPTIONS_FORCE_HTTPS
- _APP_OPTIONS_ROUTER_FORCE_HTTPS
- _APP_DOMAIN
- _APP_STORAGE_DEVICE
- _APP_STORAGE_S3_ACCESS_KEY
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
- _APP_STORAGE_DO_SPACES_BUCKET
- _APP_STORAGE_BACKBLAZE_ACCESS_KEY
- _APP_STORAGE_BACKBLAZE_SECRET
- _APP_STORAGE_BACKBLAZE_REGION
- _APP_STORAGE_BACKBLAZE_BUCKET
- _APP_STORAGE_LINODE_ACCESS_KEY
- _APP_STORAGE_LINODE_SECRET
- _APP_STORAGE_LINODE_REGION
- _APP_STORAGE_LINODE_BUCKET
- _APP_STORAGE_WASABI_ACCESS_KEY
- _APP_STORAGE_WASABI_SECRET
- _APP_STORAGE_WASABI_REGION
- _APP_STORAGE_WASABI_BUCKET
- _APP_DOMAIN_SITES
appwrite-worker-certificates:
image: appwrite/appwrite:1.7.3
entrypoint: worker-certificates
<<: *x-logging
container_name: appwrite-worker-certificates
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
volumes:
- appwrite-config:/storage/config:rw
- appwrite-certificates:/storage/certificates:rw
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DOMAIN
- _APP_DOMAIN_TARGET_CNAME
- _APP_DOMAIN_TARGET_AAAA
- _APP_DOMAIN_TARGET_A
- _APP_DOMAIN_FUNCTIONS
- _APP_EMAIL_CERTIFICATES
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_LOGGING_CONFIG
appwrite-worker-functions:
image: appwrite/appwrite:1.7.3
entrypoint: worker-functions
<<: *x-logging
container_name: appwrite-worker-functions
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
- openruntimes-executor
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DOMAIN
- _APP_OPTIONS_FORCE_HTTPS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_FUNCTIONS_TIMEOUT
- _APP_SITES_TIMEOUT
- _APP_COMPUTE_BUILD_TIMEOUT
- _APP_COMPUTE_CPUS
- _APP_COMPUTE_MEMORY
- _APP_EXECUTOR_SECRET
- _APP_EXECUTOR_HOST
- _APP_USAGE_STATS
- _APP_DOCKER_HUB_USERNAME
- _APP_DOCKER_HUB_PASSWORD
- _APP_LOGGING_CONFIG
appwrite-worker-mails:
image: appwrite/appwrite:1.7.3
entrypoint: worker-mails
<<: *x-logging
container_name: appwrite-worker-mails
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_SYSTEM_EMAIL_NAME
- _APP_SYSTEM_EMAIL_ADDRESS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_SMTP_HOST
- _APP_SMTP_PORT
- _APP_SMTP_SECURE
- _APP_SMTP_USERNAME
- _APP_SMTP_PASSWORD
- _APP_LOGGING_CONFIG
- _APP_DOMAIN
- _APP_OPTIONS_FORCE_HTTPS
appwrite-worker-messaging:
image: appwrite/appwrite:1.7.3
entrypoint: worker-messaging
<<: *x-logging
container_name: appwrite-worker-messaging
restart: unless-stopped
networks:
- appwrite
volumes:
- appwrite-uploads:/storage/uploads:rw
depends_on:
- redis
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_LOGGING_CONFIG
- _APP_SMS_FROM
- _APP_SMS_PROVIDER
- _APP_STORAGE_DEVICE
- _APP_STORAGE_S3_ACCESS_KEY
- _APP_STORAGE_S3_SECRET
- _APP_STORAGE_S3_REGION
- _APP_STORAGE_S3_BUCKET
- _APP_STORAGE_S3_ENDPOINT
- _APP_STORAGE_DO_SPACES_ACCESS_KEY
- _APP_STORAGE_DO_SPACES_SECRET
- _APP_STORAGE_DO_SPACES_REGION
- _APP_STORAGE_DO_SPACES_BUCKET
- _APP_STORAGE_BACKBLAZE_ACCESS_KEY
- _APP_STORAGE_BACKBLAZE_SECRET
- _APP_STORAGE_BACKBLAZE_REGION
- _APP_STORAGE_BACKBLAZE_BUCKET
- _APP_STORAGE_LINODE_ACCESS_KEY
- _APP_STORAGE_LINODE_SECRET
- _APP_STORAGE_LINODE_REGION
- _APP_STORAGE_LINODE_BUCKET
- _APP_STORAGE_WASABI_ACCESS_KEY
- _APP_STORAGE_WASABI_SECRET
- _APP_STORAGE_WASABI_REGION
- _APP_STORAGE_WASABI_BUCKET
appwrite-worker-migrations:
image: appwrite/appwrite:1.7.3
entrypoint: worker-migrations
<<: *x-logging
container_name: appwrite-worker-migrations
restart: unless-stopped
networks:
- appwrite
volumes:
- appwrite-imports:/storage/imports:rw
depends_on:
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DOMAIN
- _APP_DOMAIN_TARGET_CNAME
- _APP_DOMAIN_TARGET_AAAA
- _APP_DOMAIN_TARGET_A
- _APP_EMAIL_SECURITY
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_LOGGING_CONFIG
- _APP_MIGRATIONS_FIREBASE_CLIENT_ID
- _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET
appwrite-task-maintenance:
image: appwrite/appwrite:1.7.3
entrypoint: maintenance
<<: *x-logging
container_name: appwrite-task-maintenance
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_DOMAIN
- _APP_DOMAIN_TARGET_CNAME
- _APP_DOMAIN_TARGET_AAAA
- _APP_DOMAIN_TARGET_A
- _APP_DOMAIN_FUNCTIONS
- _APP_OPENSSL_KEY_V1
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_MAINTENANCE_INTERVAL
- _APP_MAINTENANCE_RETENTION_EXECUTION
- _APP_MAINTENANCE_RETENTION_CACHE
- _APP_MAINTENANCE_RETENTION_ABUSE
- _APP_MAINTENANCE_RETENTION_AUDIT
- _APP_MAINTENANCE_RETENTION_AUDIT_CONSOLE
- _APP_MAINTENANCE_RETENTION_USAGE_HOURLY
- _APP_MAINTENANCE_RETENTION_SCHEDULES
appwrite-task-stats-resources:
image: appwrite/appwrite:1.7.3
container_name: appwrite-task-stats-resources
entrypoint: stats-resources
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_USAGE_STATS
- _APP_LOGGING_CONFIG
- _APP_DATABASE_SHARED_TABLES
- _APP_STATS_RESOURCES_INTERVAL
appwrite-worker-stats-resources:
image: appwrite/appwrite:1.7.3
entrypoint: worker-stats-resources
container_name: appwrite-worker-stats-resources
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_USAGE_STATS
- _APP_LOGGING_CONFIG
- _APP_STATS_RESOURCES_INTERVAL
appwrite-worker-stats-usage:
image: appwrite/appwrite:1.7.3
entrypoint: worker-stats-usage
container_name: appwrite-worker-stats-usage
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
depends_on:
- redis
- mariadb
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_USAGE_STATS
- _APP_LOGGING_CONFIG
- _APP_USAGE_AGGREGATION_INTERVAL
appwrite-task-scheduler-functions:
image: appwrite/appwrite:1.7.3
entrypoint: schedule-functions
container_name: appwrite-task-scheduler-functions
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
depends_on:
- mariadb
- redis
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
appwrite-task-scheduler-executions:
image: appwrite/appwrite:1.7.3
entrypoint: schedule-executions
container_name: appwrite-task-scheduler-executions
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
depends_on:
- mariadb
- redis
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
appwrite-task-scheduler-messages:
image: appwrite/appwrite:1.7.3
entrypoint: schedule-messages
container_name: appwrite-task-scheduler-messages
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
depends_on:
- mariadb
- redis
environment:
- _APP_ENV
- _APP_WORKER_PER_CORE
- _APP_OPENSSL_KEY_V1
- _APP_REDIS_HOST
- _APP_REDIS_PORT
- _APP_REDIS_USER
- _APP_REDIS_PASS
- _APP_DB_HOST
- _APP_DB_PORT
- _APP_DB_SCHEMA
- _APP_DB_USER
- _APP_DB_PASS
appwrite-assistant:
image: appwrite/assistant:0.4.0
container_name: appwrite-assistant
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
environment:
- _APP_ASSISTANT_OPENAI_API_KEY
appwrite-browser:
image: appwrite/browser:0.2.4
container_name: appwrite-browser
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
openruntimes-executor:
container_name: openruntimes-executor
hostname: exc1
<<: *x-logging
restart: unless-stopped
stop_signal: SIGINT
image: openruntimes/executor:0.7.14
networks:
- appwrite
- runtimes
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- appwrite-builds:/storage/builds:rw
- appwrite-functions:/storage/functions:rw
- appwrite-sites:/storage/sites:rw
# Host mount nessessary to share files between executor and runtimes.
# It's not possible to share mount file between 2 containers without host mount (copying is too slow)
- /tmp:/tmp:rw
environment:
- OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD
- OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL
- OPR_EXECUTOR_NETWORK=$_APP_COMPUTE_RUNTIMES_NETWORK
- OPR_EXECUTOR_DOCKER_HUB_USERNAME=$_APP_DOCKER_HUB_USERNAME
- OPR_EXECUTOR_DOCKER_HUB_PASSWORD=$_APP_DOCKER_HUB_PASSWORD
- OPR_EXECUTOR_ENV=$_APP_ENV
- OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES,$_APP_SITES_RUNTIMES
- OPR_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET
- OPR_EXECUTOR_RUNTIME_VERSIONS=v5
- OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG
- OPR_EXECUTOR_STORAGE_DEVICE=$_APP_STORAGE_DEVICE
- OPR_EXECUTOR_STORAGE_S3_ACCESS_KEY=$_APP_STORAGE_S3_ACCESS_KEY
- OPR_EXECUTOR_STORAGE_S3_SECRET=$_APP_STORAGE_S3_SECRET
- OPR_EXECUTOR_STORAGE_S3_REGION=$_APP_STORAGE_S3_REGION
- OPR_EXECUTOR_STORAGE_S3_BUCKET=$_APP_STORAGE_S3_BUCKET
- OPR_EXECUTOR_STORAGE_S3_ENDPOINT=$_APP_STORAGE_S3_ENDPOINT
- OPR_EXECUTOR_STORAGE_DO_SPACES_ACCESS_KEY=$_APP_STORAGE_DO_SPACES_ACCESS_KEY
- OPR_EXECUTOR_STORAGE_DO_SPACES_SECRET=$_APP_STORAGE_DO_SPACES_SECRET
- OPR_EXECUTOR_STORAGE_DO_SPACES_REGION=$_APP_STORAGE_DO_SPACES_REGION
- OPR_EXECUTOR_STORAGE_DO_SPACES_BUCKET=$_APP_STORAGE_DO_SPACES_BUCKET
- OPR_EXECUTOR_STORAGE_BACKBLAZE_ACCESS_KEY=$_APP_STORAGE_BACKBLAZE_ACCESS_KEY
- OPR_EXECUTOR_STORAGE_BACKBLAZE_SECRET=$_APP_STORAGE_BACKBLAZE_SECRET
- OPR_EXECUTOR_STORAGE_BACKBLAZE_REGION=$_APP_STORAGE_BACKBLAZE_REGION
- OPR_EXECUTOR_STORAGE_BACKBLAZE_BUCKET=$_APP_STORAGE_BACKBLAZE_BUCKET
- OPR_EXECUTOR_STORAGE_LINODE_ACCESS_KEY=$_APP_STORAGE_LINODE_ACCESS_KEY
- OPR_EXECUTOR_STORAGE_LINODE_SECRET=$_APP_STORAGE_LINODE_SECRET
- OPR_EXECUTOR_STORAGE_LINODE_REGION=$_APP_STORAGE_LINODE_REGION
- OPR_EXECUTOR_STORAGE_LINODE_BUCKET=$_APP_STORAGE_LINODE_BUCKET
- OPR_EXECUTOR_STORAGE_WASABI_ACCESS_KEY=$_APP_STORAGE_WASABI_ACCESS_KEY
- OPR_EXECUTOR_STORAGE_WASABI_SECRET=$_APP_STORAGE_WASABI_SECRET
- OPR_EXECUTOR_STORAGE_WASABI_REGION=$_APP_STORAGE_WASABI_REGION
- OPR_EXECUTOR_STORAGE_WASABI_BUCKET=$_APP_STORAGE_WASABI_BUCKET
mariadb:
image: mariadb:10.11 # fix issues when upgrading using: mysql_upgrade -u root -p
container_name: appwrite-mariadb
<<: *x-logging
restart: unless-stopped
networks:
- appwrite
volumes:
- appwrite-mariadb:/var/lib/mysql:rw
environment:
- MYSQL_ROOT_PASSWORD=${_APP_DB_ROOT_PASS}
- MYSQL_DATABASE=${_APP_DB_SCHEMA}
- MYSQL_USER=${_APP_DB_USER}
- MYSQL_PASSWORD=${_APP_DB_PASS}
- MARIADB_AUTO_UPGRADE=1
command: 'mysqld --innodb-flush-method=fsync'
redis:
image: redis:7.2.4-alpine
container_name: appwrite-redis
<<: *x-logging
restart: unless-stopped
command: >
redis-server
--maxmemory 512mb
--maxmemory-policy allkeys-lru
--maxmemory-samples 5
networks:
- appwrite
volumes:
- appwrite-redis:/data:rw
# clamav:
# image: appwrite/clamav:1.2.0
# container_name: appwrite-clamav
# restart: unless-stopped
# networks:
# - appwrite
# volumes:
# - appwrite-uploads:/storage/uploads
networks:
gateway:
name: gateway
appwrite:
name: appwrite
runtimes:
name: runtimes
volumes:
appwrite-mariadb:
appwrite-redis:
appwrite-cache:
appwrite-uploads:
appwrite-imports:
appwrite-certificates:
appwrite-functions:
appwrite-sites:
appwrite-builds:
appwrite-config:

25
arcane/agent-compose.yaml Normal file
View File

@@ -0,0 +1,25 @@
# carlo: fEpbsshKL67xntGZXvig9eKGtQPeYS8N
# gary: rbJ75M7coTZCxmocSQ9DDFhbRE5BzgB5
# sandy: y2R7MyVcN2KgG7Dkjh8bZZP7YJEFgmAq
# krabs: D5RQ5andUN6mN9QViEzjidqkyDHSDMqv
# sheldon: nr4qbG58vppNuAEg648DYa2Xt45DmTYP
# bernie: ro4fTDt37QuCSkMEGLzNLcQNqapgKbjS
---
name: arcane-agent
volumes:
agent-data: {}
services:
arcane-agent:
image: ghcr.io/ofkm/arcane-headless:latest
container_name: arcane-agent
ports:
- '3553:3553'
environment:
- AGENT_MODE=true
- AGENT_BOOTSTRAP_TOKEN=${TOKEN:-xxxxxxxxxxxxxxxxxxxx}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- agent-data:/app/data
restart: unless-stopped

View File

@@ -0,0 +1,24 @@
# bob (dkr.delmar.bzh)
---
name: arcane
volumes:
arcane-data:
services:
arcane:
image: ghcr.io/ofkm/arcane:latest
container_name: arcane
ports:
- '32519:3552'
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- arcane-data:/app/data
- /mnt/data/docker:/app/data/projects
environment:
- APP_URL=https://dkr.delmar.bzh
- PUID=1000
- PGID=1000
- ENCRYPTION_KEY=wRixZ38z76kQZA9AR7ECJveevp3BbR5d
- JWT_SECRET=hG9JUXuuocrDBdKRU6NnwaaARCVfVYbF
restart: unless-stopped

21
arr-suite/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 pvd-nerd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

38
arr-suite/README.md Normal file
View File

@@ -0,0 +1,38 @@
# Automated Media Management Setup
After years of trial, error, and endless Reddit dives, I built the guide I wish I had from the start—a clear, step-by-step walkthrough to fully automate your seedbox in a secure, reliable way. Whether you're new or a seasoned tweaker, this will streamline your media setup from start to finish.
Below is a quick overview of the Docker containers used and what each one does.
- 🔒 Gluetun: A sleek, all-in-one VPN client supporting multiple providers—your digital Swiss Army knife, ensuring your privacy remains rock-solid while torrenting and streaming.
- 🌐 Traefik: A modern, lightweight reverse proxy and load balancer—your traffics front door with smart routing, automatic HTTPS via Let's Encrypt, and seamless Docker integration. Simple to use, powerful to scale.
- ⬇️ qBittorrent: The reliable, open-source alternative to µTorrent, built on Qt and libtorrent-rasterbar, providing a lightweight yet robust solution for downloading torrents with ease.
- 🔄 qBittorrent Port Forwarder: Automatically syncs qBittorrent's ports through Gluetun, ensuring maximum connectivity and optimal speeds without manual port configuration headaches.
- 🎬 Radarr: Automates movie downloads and management—think CouchPotato, but smarter, slicker, and fully integrated into your workflow, making movie management a breeze.
- 📺 Sonarr: Your personal TV assistant, automatically fetching, sorting, renaming, and even upgrading episodes. It monitors RSS feeds and ensures your TV shows are always ready and waiting.
- 🔍 Prowlarr: Centralized management for torrent and Usenet indexers—effortlessly integrated across Sonarr, Radarr, Lidarr, and Readarr, eliminating the hassle of configuring indexers individually for each app.
- 📦 Unpackerr: Watches completed downloads, swiftly unpacking files so they're instantly ready for import by your media apps, removing yet another manual step from your workflow.
- 📝 Overseerr & Jellyseerr: Easy, user-friendly media request tools for Sonarr, Radarr, Plex, and Jellyfin—making content requests and approvals a breeze.
- 📡 Plex & Jellyfin: Stream and organize your media anywhere. Plex offers sleek, remote access; Jellyfin is open-source and privacy-focused—both keep your library beautifully managed.
- 🚢 Watchtower: Automatically keeps your Docker containers up to date with the latest images—set it and forget it for a smoother, more secure stack.
By the end of this guide, you'll have a powerful, fully-automated media system that's secure, efficient, and hassle-free.
Check out the full guide here: https://passthebits.com/
## Quick Start
Carefully read the entire compose file before deploying. Comments are included with details and additional supported variables. Confirm that all uncommented service variables and volumes are correctly configured before deploying. The compose file is available on GitHub.
```
git clone https://github.com/pvd-nerd/docker-arr-suite $HOME/media_stack
cd $HOME/media_stack
chmod +x media.sh
# Pull all container images before launch.
sudo docker compose pull
# Start stack services. Initial startup may take a while.
# If startup fails, consider increasing the `start_period` in the compose file.
sudo docker compose up -d
```
Some containers won't start until environment variables are set. Allow them to restart continuously initially.

139
arr-suite/arr-compose.yml Normal file
View File

@@ -0,0 +1,139 @@
---
networks:
default:
name: media_network
driver: bridge
attachable: true
volumes:
data: # Sonarr, Radarr, Prowlarr, and Unpackerr data mount
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/data"
sonarr: # Sonarr app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/sonarr"
radarr: # Radarr app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/radarr"
prowlarr: # Prowlarr app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/prowlarr"
unpackerr: # unPackerr app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/unpackerr"
services:
sonarr:
# See more: https://docs.linuxserver.io/images/docker-sonarr
image: lscr.io/linuxserver/sonarr
container_name: sonarr
restart: always
network_mode: service:gluetun
env_file: ./env/arr.env
volumes:
- sonarr:/config
- data:/media
healthcheck:
test: curl -f http://localhost:8989/ping || exit 1
interval: 10s
timeout: 3s
start_period: 60s
depends_on:
gluetun:
condition: service_healthy
restart: true
bittorrent:
condition: service_healthy
restart: true
radarr:
# See more: https://docs.linuxserver.io/images/docker-radarr
image: lscr.io/linuxserver/radarr:latest
container_name: radarr
restart: always
network_mode: service:gluetun
env_file: ./env/arr.env
volumes:
- radarr:/config
- data:/media
healthcheck:
test: curl -f http://localhost:7878/ping || exit 1
interval: 10s
timeout: 3s
start_period: 60s
depends_on:
gluetun:
condition: service_healthy
restart: true
bittorrent:
condition: service_healthy
restart: true
prowlarr:
# See more: https://docs.linuxserver.io/images/docker-prowlarr
image: lscr.io/linuxserver/prowlarr:latest
container_name: prowlarr
restart: always
network_mode: service:gluetun
env_file: ./env/arr.env
volumes:
- prowlarr:/config
- data:/media
healthcheck:
test: curl -f http://localhost:9696/ping || exit 1
interval: 10s
timeout: 3s
start_period: 60s
depends_on:
gluetun:
condition: service_healthy
restart: true
qbittorrent:
condition: service_healthy
restart: true
sonarr:
condition: service_healthy
restart: true
radarr:
condition: service_healthy
restart: true
unpackerr:
# See more: https://unpackerr.zip/docs/install/compose
image: golift/unpackerr
container_name: unpackerr
restart: always
secrets:
- radarr-api
- sonarr-api
env_file: ./env/arr.env
volumes:
- data:/media
- unpackerr:/config
depends_on:
sonarr:
condition: service_healthy
restart: true
radarr:
condition: service_healthy
restart: true

View File

@@ -0,0 +1,63 @@
---
networks:
default:
name: media_network
driver: bridge
attachable: true
volumes:
torrent: # torrent data mount
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/data/torrents"
bittorrent: # qBittorrent app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/bittorrent"
secrets:
bittorrent-user:
file: ./secrets/bittorrent-user.secret
bittorrent-password:
file: ./secrets/bittorrent-password.secret
services:
bittorrent:
# See more: https://docs.linuxserver.io/images/docker-qbittorrent
image: lscr.io/linuxserver/qbittorrent:latest
container_name: bittorrent
restart: always
network_mode: service:gluetun
env_file: ./env/bittorrent.env
volumes:
- bittorrent:/config
- torrent:/media
healthcheck:
test: curl -f http://localhost:9080 || exit 1
interval: 10s
timeout: 3s
start_period: 60s
depends_on:
gluetun:
condition: service_healthy
restart: true
bittorrent_port_forwarder:
# See more: https://github.com/mjmeli/qbittorrent-port-forward-gluetun-server
image: mjmeli/qbittorrent-port-forward-gluetun-server
container_name: bittorrent_port_forwarder
restart: always
secrets:
- bittorrent-user
- bittorrent-password
env_file: ./env/bittorrent.env
depends_on:
bittorrent:
condition: service_healthy
restart: true

View File

@@ -0,0 +1,48 @@
---
networks:
default:
name: media_network
driver: bridge
attachable: true
volumes:
gluetun: # Gluetun app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/gluetun"
secrets:
wireguard_private_key:
file: ./secrets/wireguard_private_key.secret
services:
gluetun:
# See more: https://github.com/qdm12/gluetun-wiki
image: qmcgaw/gluetun
container_name: gluetun
restart: always
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
secrets:
- wireguard_private_key
env_file: ./env/gluetun.env
volumes:
- gluetun:/gluetun
watchtower:
# See more: https://github.com/containrrr/watchtower
image: containrrr/watchtower
container_name: watchtower
env_file: ./env/watchtower.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock
include:
- bittorrent-compose.yml
- arr-compose.yml
- jellyfin-compose.yml

12
arr-suite/env/arr.env vendored Normal file
View File

@@ -0,0 +1,12 @@
# arr.env
PUID: 1000
PGID: 1000
TZ: Etc/UTC
# unpackerr.env
UN_LOG_FILE: /config/unpackerr.log
UN_SONARR_0_URL: http://gluetun:8989
# Update with Sonarr API key
UN_SONARR_0_API_KEY: /run/secrets/sonarr-api
UN_RADARR_0_URL: http://gluetun:7878
# Update with Radarr API key
UN_RADARR_0_API_KEY: /run/secrets/radarr-api

10
arr-suite/env/bittorrent.env vendored Normal file
View File

@@ -0,0 +1,10 @@
# qBittorrent
PUID: 1000
PGID: 1000
TZ: Europe/Paris
WEBUI_PORT: 9080
# Bittorrent Port Forwarder
QBT_USERNAME: /run/secrets/bittorrent-user
QBT_PASSWORD: /run/secrets/bittorrent-passowrd
QBT_ADDR: http://gluetun:9080
GTN_ADDR: http://gluetun:8000

10
arr-suite/env/gluetun.env vendored Normal file
View File

@@ -0,0 +1,10 @@
# gluetun.env
PUID: 1000
PGID: 1000
VPN_SERVICE_PROVIDER: protonvpn
VPN_TYPE: wireguard
TZ: Europe/Paris
# Wireguard Settings:
WIREGUARD_PRIVATE_KEY: /run/secrets/wireguard_private_key
WIREGUARD_ADDRESSES: 10.2.0.2/32
SERVER_COUNTRIES: France

5
arr-suite/env/jellyfin.env vendored Normal file
View File

@@ -0,0 +1,5 @@
# jellyfin.env
JELLYFIN_PublishedServerUrl: https://jellyfin.${DOMAIN}
# jellyseerr.env
LOG_LEVEL: debug
TZ: Europe/Paris

9
arr-suite/env/plex.env vendored Normal file
View File

@@ -0,0 +1,9 @@
# plex.env
PUID: 1000
PGID: 1000
TZ: Etc/UTC
VERSION: docker
# Get claim from https://account.plex.tv/en/claim
PLEX_CLAIM: /run/secrets/plex-claim
LOG_LEVEL: debug
PORT: 5055

3
arr-suite/env/traefik.env vendored Normal file
View File

@@ -0,0 +1,3 @@
# traefik.env
CF_DNS_API_TOKEN_FILE: /run/secrets/cloudflare-token
CF_API_EMAIL_FILE: /run/secrets/cloudflare-email

4
arr-suite/env/watchtower.env vendored Normal file
View File

@@ -0,0 +1,4 @@
# watchtower.env
WATCHTOWER_CLEANUP: true
WATCHTOWER_INCLUDE_RESTARTING: true
WATCHTOWER_POLL_INTERVAL: 86400

View File

@@ -0,0 +1,67 @@
---
networks:
default:
name: media_network
driver: bridge
attachable: true
volumes:
media: # Media library
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/data/media"
jellyseerr: # Jellyseerr app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/jellyseerr"
jellyfin: # Jellyfin app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/jellyfin"
cache: # Jellyfin cache data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/jellyfin_cache"
services:
jellyfin:
image: jellyfin/jellyfin
container_name: jellyfin
restart: always
user: 1000:1000
# Network mode of 'host' exposes the ports on the host. This is needed for DLNA access.
# network_mode: 'host'
volumes:
- jellyfin:/config
- cache:/cache
- media:/media
env_file: ./env/jellyfin.env
healthcheck:
test: curl -i http://localhost:8096/health || exit 1
interval: 10s
timeout: 3s
start_period: 60s
jellyseerr:
image: fallenbagel/jellyseerr:latest
container_name: jellyseerr
restart: always
env_file: ./env/jellyfin.env
volumes:
- jellyseerr:/app/config
depends_on:
jellyfin:
condition: service_healthy
restart: true

View File

@@ -0,0 +1,68 @@
---
networks:
default:
name: media_network
driver: bridge
attachable: true
volumes:
media: # Media library
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/data/media"
overseerr: # Overseerr app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/overseerr"
plex: # Plex app data.
driver: local
driver_opts:
type: "nfs"
o: "addr=${NFS_SERVER},rw,tcp,nolock,hard,wsize=65536,rsize=65536"
device: ":${NFS_VOLUME}/docker_data/plex"
secrets:
plex-claim:
file: ./secrets/plex-claim.secret
services:
overseerr:
# See more: https://docs.overseerr.dev/getting-started/installation
image: sctx/overseerr:latest
container_name: overseerr
restart: always
env_file: ./env/plex.env
volumes:
- overseerr:/app/config
healthcheck:
test: wget http://localhost:5055/api/v1/status -qO /dev/null || exit 1
interval: 10s
timeout: 3s
start_period: 60s
depends_on:
plex:
condition: service_healthy
restart: true
plex:
# See more: https://docs.linuxserver.io/images/docker-plex/
image: lscr.io/linuxserver/plex:latest
container_name: plex
restart: always
secrets:
- plex-claim
env_file: ./env/plex.env
volumes:
- plex:/config
- media:/media
healthcheck:
test: curl -f http://localhost:32400/identity || exit 1
interval: 10s
timeout: 3s
start_period: 60s

View File

@@ -0,0 +1 @@
BITTORRENTPASS

View File

@@ -0,0 +1 @@
BITTORRENTUSER

View File

@@ -0,0 +1 @@
CLOUDFLAREEMAIL

View File

@@ -0,0 +1 @@
CLOUDFLAREAPI

View File

@@ -0,0 +1 @@
OPENVPNPASS

View File

@@ -0,0 +1 @@
OPENVPNUSER

View File

@@ -0,0 +1 @@
PLEXCLAIM

View File

@@ -0,0 +1 @@
RADARRAPI

View File

@@ -0,0 +1 @@
SONARRAPI

View File

@@ -0,0 +1 @@
QHpbGPtMm2M30HrWPzoseJAxJd9lJeTjZs28wsVS+Vc=

182
arr-suite/temp.env Normal file
View File

@@ -0,0 +1,182 @@
#################################################################################
#################################################################################
#################################################################################
##
## Docker Compose Environment Variable file for Jellyfin / *ARR Media Stack
##
## Update any of the environment variables below as required.
##
## It is highly recommended Linux users set up a "docker" user, so the
## applications can access the local filesystem with this user's access
## privileges. Use PUID / PGID to map user access between the Docker apps
## and local filesystem.
##
## The MediaStack Guide is located at https://MediaStack.Guide
##
#################################################################################
#################################################################################
#################################################################################
# Name of the project in Docker
COMPOSE_PROJECT_NAME=mediastack
COMPOSE_BAKE=true
# This is the network subnet which will be used inside the docker "media_network", change as required.
# LOCAL_SUBNET is your home network and is needed so the VPN client allows access to your home computers.
DOCKER_SUBNET=172.28.10.0/24
DOCKER_GATEWAY=172.28.10.1
LOCAL_SUBNET=192.168.1.0/24 # This is the IP Subnet used on your home network
LOCAL_DOCKER_IP=192.168.1.10 # This is the IP Address of your Docker computer
# Each of the "*ARR" applications have been configured so the theme can be changed to your needs.
# Refer to Theme Park for more info / options: https://docs.theme-park.dev/theme-options/aquamarine/
TP_THEME=nord
# If you intend to use Plex as your Media Server, then enter your Plex Claim
# information below, to link this Plex Media Server to your Plex account
# Access Plex claim at: https://account.plex.tv/en/claim
PLEX_CLAIM=claim-1234567890abcdef
# These are the folders on your local host computer / NAS running docker, they MUST exist
# and have correct permissions for PUID and PGUI prior to running the docker compose.
#
# Use the commands in the Guide to create all the sub-folders in each of these folders.
# Host Data Folders - Will accept Linux, Windows, NAS folders.
# Make sure these folders exists before running the "docker compose" command.
FOLDER_FOR_MEDIA=/your-media-folder # <-- Update for your folders - Synology Example: /volume1/media
FOLDER_FOR_DATA=/your-app-configs # <-- Update for your folders - Synology Example: /volume1/docker/appdata
# File access, date and time details for the containers / applications to use.
# Run "sudo id docker" on host computer to find PUID / PGID and update these to suit.
PUID=1000
PGID=1000
UMASK=0002
TIMEZONE=Europe/Zurich
# Update your own Internet VPN provide details below
# Online documentation: https://github.com/qdm12/gluetun-wiki/tree/main/setup/providers
VPN_TYPE=openvpn
VPN_SERVICE_PROVIDER=VPN provider name
VPN_USERNAME=<username from VPN provider>
VPN_PASSWORD=<password from VPN provider>
# You MUST provide at least one entry to the SERVER variables below, that supports your VPN provider's settings.
# If you want to add more than one entry per line, use comma separated values: "one,two,three" etc...
SERVER_COUNTRIES=
SERVER_REGIONS=Europe
SERVER_CITIES=
SERVER_HOSTNAMES=
SERVER_CATEGORIES=
# Fill in this item ONLY if you're using a custom OpenVPN configuration
# Should be inside gluetun data folder - Example: /gluetun/custom-openvpn.conf
# You can then edit it inside the FOLDER_FOR_DATA location for gluetun.
OPENVPN_CUSTOM_CONFIG=
GLUETUN_CONTROL_PORT=8320
# Fill in these items ONLY if you change VPN_TYPE to "wireguard"
VPN_ENDPOINT_IP=
VPN_ENDPOINT_PORT=
WIREGUARD_PUBLIC_KEY=
WIREGUARD_PRIVATE_KEY=
WIREGUARD_PRESHARED_KEY=
WIREGUARD_ADDRESSES=
# These are the ports used to access each of the applications in your web browser.
# You can safely change these if you need, but they can't conflict with other active ports.
QBIT_PORT=6881
FLARESOLVERR_PORT=8191
TDARR_SERVER_PORT=8266
# WebUI ports for internal access to applications
WEBUI_PORT_AUTHENTIK=6080
WEBUI_PORT_BAZARR=6767
WEBUI_PORT_CHROMIUM=3650
WEBUI_PORT_DDNS_UPDATER=8310
WEBUI_PORT_FILEBOT=5454
WEBUI_PORT_GUACAMOLE=9200
WEBUI_PORT_GRAFANA=3800
WEBUI_PORT_HEADPLANE=3500
WEBUI_PORT_HEIMDALL=2080
WEBUI_PORT_HOMARR=3200
WEBUI_PORT_HOMEPAGE=3000
WEBUI_PORT_HUNTARR=9705
WEBUI_PORT_JELLYFIN=8096
WEBUI_PORT_JELLYSEERR=5055
WEBUI_PORT_LIDARR=8686
WEBUI_PORT_MYLAR=8090
WEBUI_PORT_PLEX=32400
WEBUI_PORT_PORTAINER=9000
WEBUI_PORT_PROMETHEUS=9090
WEBUI_PORT_PROWLARR=9696
WEBUI_PORT_QBITTORRENT=8200
WEBUI_PORT_RADARR=7878
WEBUI_PORT_READARR=8787
WEBUI_PORT_SABNZBD=8100
WEBUI_PORT_SONARR=8989
WEBUI_PORT_TDARR=8265
WEBUI_PORT_TRAEFIK=8080
WEBUI_PORT_WHISPARR=6969
CHROMIUM_START_PAGE="https://github.com/geekau/mediastack/"
# Traefik is configured for Reverse Proxy. Set your Internet gateway to redirect incoming ports 80 and 443
# to the ports used below (using Docker IP Address), and they will be translated back to 80 and 443 by Traefik.
# Change these port numbers if you have conflicting services running on the Docker host computer.
# If ports 80 and 443 are already used, then adjust and redirect incoming ports to 5080 and 5443, or similar.
REVERSE_PROXY_PORT_HTTP=80
REVERSE_PROXY_PORT_HTTPS=443
# Traefik Configuration
CLOUDFLARE_EMAIL=email@example.com # Your CloudFlare Account Email Address
CLOUDFLARE_DNS_ZONE=example.com # Your CloudFlare Registered Domain Name
CLOUDFLARE_DNS_API_TOKEN=1234567890abcdef1234567890... # Your CloudFlare Read / Write API Token
# Headscale / Headplane / Tailscale VPN Wireguard Mesh Networking
# These port settings are only to change the internal port due to conflicts, Headscale, Tailscale and Headplane will
# all function normally using the default ports as they are routed through Traefik reverse proxy.
CONNECT_PORT_HEADSCALE=4080
METRICS_PORT_HEADSCALE=4090
CROWDSEC_PORT=9080
METRICS_PORT_TRAEFIK=8082
METRICS_PORT_UNPACKERR=5656
# The Tailscale Docker container is configured as an exit node inside your home network, so traffic can route securely
# across the Internet, and break out behind your home gateway / router.
# sudo docker exec -it headscale headscale users create exit-node
# sudo docker exec -it headscale headscale --user exit-node preauthkeys create
# NOTE: Headscale must be running before the commands can be executed, then update authkey below and restart Tailscale.
TAILSCALE_AUTHKEY=1234567890abcdef1234567890abcdef1234567890abcdef
# Connect to the following address to complete the initial setup of Authentik after first deployment:
# http://<DOCKER-IP-ADDRESS>:6080/if/flow/initial-setup/
# echo AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d '\n')
AUTHENTIK_SECRET_KEY=1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
AUTHENTIK_VERSION=2025.4.1
AUTHENTIK_ERROR_REPORTING__ENABLED=true
POSTGRESQL_PORT=5432
VALKEY_PORT=6379
# echo POSTGRESQL_PASSWORD=$(openssl rand -base64 60 | tr -d '\n')
POSTGRESQL_PASSWORD=1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
POSTGRESQL_USERNAME=mediastack-postgresql
AUTHENTIK_DATABASE=mediastack-authentik
GUACAMOLE_DATABASE=mediastack-guacamole
GUACD_PORT=4822
# SMTP Host Emails are sent to
EMAIL_SERVER_HOST=mail.example.com
EMAIL_SERVER_PORT=25
# Optionally authenticate (don't add quotation marks to your password)
EMAIL_ADDRESS=email.address@example.com
EMAIL_PASSWORD=email-password-here
# Use StartTLS
EMAIL_TLS=true
# Use SSL - StartTLS and SSL can't both be true
EMAIL_SSL=false
# Email address authentik will send from, should have a correct @domain.name
EMAIL_SENDER=authentik@example.com

1768
arr-suite/temp.yaml Normal file

File diff suppressed because it is too large Load Diff

20
authelia/compose.yaml Normal file
View File

@@ -0,0 +1,20 @@
networks:
net:
driver: bridge
volumes:
config:
services:
authelia:
container_name: authelia
image: docker.io/authelia/authelia:latest
restart: unless-stopped
networks:
net: {}
ports:
- 9091:9091
environment:
TZ: ${TZ}
volumes:
- config:/config

View File

@@ -0,0 +1,56 @@
---
###############################################################
# Authelia configuration #
###############################################################
server:
address: 'tcp://:9091'
log:
level: 'debug'
totp:
issuer: 'authelia.com'
identity_validation:
reset_password:
jwt_secret: 'S3SorNdAWR786SeTP7a9MBNQQbSqRTGFitqRtemT7VD6PQtmQHsXhPGgs7bfKTvp'
authentication_backend:
file:
path: '/config/users_database.yml'
access_control:
default_policy: 'deny'
rules:
- domain: 'www.delmar.bzh'
policy: 'bypass'
- domain: 'dkr.delmar.bzh'
policy: 'one_factor'
- domain: 'cloud.delmar.bzh'
policy: 'two_factor'
session:
secret: 'M7SQ7ornWrDas6ienGHmRJaNrX93KNLCTi8ggM3QMiKKcCdjAwyJrLFK3oSVgsfG'
cookies:
- name: 'authelia_session'
domain: 'delmar.bzh' # Should match whatever your root protected domain is
authelia_url: 'https://auth.delmar.bzh'
expiration: '1 hour' # 1 hour
inactivity: '5 minutes' # 5 minutes
default_redirection_url: 'https://public.example.com'
regulation:
max_retries: 3
find_time: '2 minutes'
ban_time: '5 minutes'
storage:
encryption_key: 'yxmVn7chQz6PWEwPyXYSnHo9y42sWMfEXvLxRA6wPsZdj5Jb2ZGM9dVjgUTUSnbx'
local:
path: '/config/db.sqlite3'
notifier:
filesystem:
filename: '/config/notification.txt'

View File

@@ -0,0 +1,17 @@
---
###############################################################
# Users Database #
###############################################################
# This file can be used if you do not have an LDAP set up.
# List of users
users:
admin:
disabled: false
displayname: 'Admin'
password: 'X5r53JMPVg97EKfL'
email: 'admin@delmar.bzh'
groups:
- 'admins'
- 'dev'

View File

@@ -0,0 +1,31 @@
-----BEGIN CERTIFICATE-----
MIIFUzCCAzugAwIBAgIRAO/ljk7+ck+qhez8D5V3f1AwDQYJKoZIhvcNAQELBQAw
HTEbMBkGA1UEAwwSYXV0aGVudGlrIDIwMjUuMi40MB4XDTI1MDUyNDIyMjAxMVoX
DTI2MDUyNTIyMjAxMVowVjEqMCgGA1UEAwwhYXV0aGVudGlrIFNlbGYtc2lnbmVk
IENlcnRpZmljYXRlMRIwEAYDVQQKDAlhdXRoZW50aWsxFDASBgNVBAsMC1NlbGYt
c2lnbmVkMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyz/EnjizgNvT
uKX/mDn+IwWJWFKAphVuNtCmg0dWv79JofaI8R16QXpKL4WGTByK9CzPpE/IsvRs
iS04WEV+FUVTNG+CCSZUuZKqgl20XiFk5QTDa1RUXrHWKS4owMtppnLy/gO6/cpJ
PvYOwO0RVmAQBohCukPoG/vjUh/Jyd3sSdq5A9K6TgcGUZk8SrFgW1RWA5dn+F7p
ssEVjLst96bMFknD8zfQ8V9cQOKsHf6RmCTtiz0tZ6P/QxSoWRnB19oNnQESuau7
XMTJSYka4LnharSuZFeYqfnUYFlDScsrEivouOdo05TtbBRbLHDaVjXCWfe7UOsl
zzLYPu08RfPAlgLQXN1vhEroJNbY/8jMD0bQ5cogMMzhllBm6Z0pJgWgX+ZiKTHg
KDxKhz/z9FUpw99W9tEKH4lknKz5aFINr6ZthTnTV3fOxhTU49feak6jFj18ssxd
yzpfoMg8xjfqqA5aA+yKfOmxxGJYJhuZGtXZXc1yqAwa9RjGbCd6En0yqk96QfFL
TvQYX9EKCDfnYFS8mqLOIotsnqDpYr8Zehr8aCUWlTegRe7H8/KcMe/uwhfOpZ4i
+gkwC36gIwRXi10kH8gkQyw61YKd9uIJFYUZjaZQNxZFNQqMixownKTqRPru6YUN
rD3Kgu+EI4gVh8gUJ/U3jBgV36c9moECAwEAAaNVMFMwUQYDVR0RAQH/BEcwRYJD
T3QzN2U3NGIwRDJyOFU4ZlpFeUdyR3I2Wms4WGFWYXM4QnE5S1NNZS5zZWxmLXNp
Z25lZC5nb2F1dGhlbnRpay5pbzANBgkqhkiG9w0BAQsFAAOCAgEAMNfTfHxWxi+I
3wUnIyW6w8+m41Uz5OIBtYjGNQrZN1TeP0lW7Ciw9C2Q4WF0gD5EFEilSvLt87Im
L5KI5VpdOprdD8uJ1+Hpv2UJOLiWf9Ii40WrP0R/pD9BuNRf96XAHLwj/nGnnT4k
OFFLdMap3L7ivAA5scj2G4P5q6dEJgVg6T2iM7IAcmUi33uVHzK+lXfNqlDp/fVE
0I/W6KZGEV2fCAf+B2eqjqyBVVe9WEGnvxxMR1Bsmajkh3lwyomXdYCYWMHe11QT
rYy7If3RJPTVD/gSuzm7ybw7eL55Jmzdn4boOLUl4WU/X33fliC8vFlPE+beWaRD
eUziXSdq9lqLgvARE53EcSTUASraqYsxgsHhrNkMmOEOQUw60vcpmKPxic5B2/Lr
etJQ41fNquVu8EqZax67Yfo/saxcuC8EgX0gEITjO33j4ERPoTRI8b0Vy0MpaegU
du8+vJMvW2x+1G6TXbZkSBzS0TbfzzC0tkfZJl9rugLPGfu9Btb65oXTKo2IDklp
CmapiK4lWBMfnSWNgDS5jBcYV6/1xFH3ZnzbOWIIWMTVIC2OqhiC8dvWeMrrq4nc
ypkYJsTVUyxAzaSw5VU2Da7sy1IDhz+HTDYf54Z900M4B2LUUlRQsF7bzN0H/w3G
jGcUd5es8VCJBMmaHx2iCDz+Dic3hqA=
-----END CERTIFICATE-----

View File

@@ -0,0 +1,51 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJKAIBAAKCAgEAyz/EnjizgNvTuKX/mDn+IwWJWFKAphVuNtCmg0dWv79JofaI
8R16QXpKL4WGTByK9CzPpE/IsvRsiS04WEV+FUVTNG+CCSZUuZKqgl20XiFk5QTD
a1RUXrHWKS4owMtppnLy/gO6/cpJPvYOwO0RVmAQBohCukPoG/vjUh/Jyd3sSdq5
A9K6TgcGUZk8SrFgW1RWA5dn+F7pssEVjLst96bMFknD8zfQ8V9cQOKsHf6RmCTt
iz0tZ6P/QxSoWRnB19oNnQESuau7XMTJSYka4LnharSuZFeYqfnUYFlDScsrEivo
uOdo05TtbBRbLHDaVjXCWfe7UOslzzLYPu08RfPAlgLQXN1vhEroJNbY/8jMD0bQ
5cogMMzhllBm6Z0pJgWgX+ZiKTHgKDxKhz/z9FUpw99W9tEKH4lknKz5aFINr6Zt
hTnTV3fOxhTU49feak6jFj18ssxdyzpfoMg8xjfqqA5aA+yKfOmxxGJYJhuZGtXZ
Xc1yqAwa9RjGbCd6En0yqk96QfFLTvQYX9EKCDfnYFS8mqLOIotsnqDpYr8Zehr8
aCUWlTegRe7H8/KcMe/uwhfOpZ4i+gkwC36gIwRXi10kH8gkQyw61YKd9uIJFYUZ
jaZQNxZFNQqMixownKTqRPru6YUNrD3Kgu+EI4gVh8gUJ/U3jBgV36c9moECAwEA
AQKCAgAUzH0/3biMxrIXUrFhsAmQJuhjp+mvVUEWjeqEQ6AediJAVzyzQ9t3aN6/
ly/jiQY1L4K+I0X7/iQ/M2fxLIdXAOWfV4vciNYhuV8GgTVMbqlnAEJJMPODTzqF
s0oLVKWGmXvBP7t6biFptn9TAc+E4cayDG6bpghSGMgt5r/dDv83nZDSUdWr128v
mXlAgX9FSU+WBX/nvDq5BqZAZQUysxhubXUGZh9VG/eSUj/fv+XBRoIifguv7+nW
wP3rREYAYzmCaBI0+txtBVw90LB177+gDkZMUWR3fG/dvjSzD/3j2adyiIfDIxna
tgiQdyn4qX6ueznpcW7IkcDsS5Wfui/RXwpF8v+jpMAp74/+tufrWW09cntWPO9R
cYGUWuGEAaGVRxLMLhKoYu+xh1vXhpjzEoHis4gGu3Eyi/T2bfH1Uy6BFfaIaRbx
Si6QMhF8pDiTCjxuNqn6fT1TopVgbRFYIWEv2cUMiXKetWnwwtMMzHE4Wp9fWa/y
Ifteq34wy7DJj0tXW05alfhDjlxhtFPv6b06Fd9YL9+OaIA1T1bcx+gQjgYXBcYp
u+mNTSvtWVhEkyALcho8d7tVnxd7UvhrqTbuim63sfDdYrapchDgWp9vRRlR4MKw
KtxWO1s35u+wO6IIJ7JH6/tjyuQKP+xirsN1bPGW4BKy9witOQKCAQEA7+LT/ycm
WR22esY04a2ijzVCUbMoOpPrmRQdUK64r08+K7YfPpaUmKJHYMtCDzYFyoKIhU4I
zF2S3HN0/CVBjSCLqgIeVvLSuoZ+B0Vu2lvVxcgtGBaHI9/KMa78DKx4KDwksQ2v
8nATNqVvN8KvERR/Xu+9RgTqFx7yHCPeK7kr1VM1PqIofBywzFxtEPseW8toY1+B
oZ3nXGe9jkQgf2SeS7gogebsvqBfuSFZ0mNYyzQ//Y34g/wwR0puKbi0baah2k6V
KaAN+4u6y2UwNjl+St1KOwEyn2q+Q4KZ2X/pyg57i6j/MJUJ4kmf/iHP4m6vNR8e
088xMEn6Fv7BdQKCAQEA2ObquuZYf6PeQA9cDUvz0SVEf61Fjw9YJPOcbd0b0lCp
rsIeRpGHxxyJZuXgs2jLMlzPJ7AOvBm68O3L3L7CqrnAN+XdxiEIrQu57ySZcH77
6lGicJlSpa3ihri9n8sNGEKTEEsUItYhdYwWkCdVE7mCRXXNWU7wNUEvobWYu+qS
33eU+XLS1YUel2SNebDRNjpOVpcbSonWZsdpYfF567i/YWAieIEiYT/k6KqLcLLm
84og3Ri+4niH1fHasiKQQhLbNeUk4ItDxAtfXWunNXJSGSEbrlDoZ6Orwh1PpP0l
q49hGTk2UlEkDjtJ4cJS4pGoEijij7417gQCDManXQKCAQA6OYEhRjxdlwOqqx88
w6tYPSIauHSEO1EM97/hzHbRPlelvm+4/k2U+pZ+nPcsv/0J2UMPsBAcon25+mAj
r1tIyOR9YERC8G9LjMdcNnMglve9KMghN56Xi4MFKibNYLNNeMOjIeJZ4vAW7HKh
QyTA7Yu43FHBhAHZmM5FHEOZszk7bxXWXP+cmE4lXC2w2HLW7vkoXY8WTkBQwnFU
7Z5BrYdqc4mJdiZyYnS5d6nYkfqEX+tEPMhcKMMDGsLAZ6+Lic1xMm+sCcg7DQBK
zAW2s5++xhV1WuYRoZQKyNFU5GI3g+pizKMcBKDAhwRJZ6WQnTLzntkZqgmTYfFM
0YrdAoIBADhnA88KKyU15Yte8x76CzLtr/xLgHUNFmy1dI4VGzD7jMRG8jyDh309
bHV3fZDpxT0ZaTz2yT4cqsIP9B049cITf2qJubvVxz3IeNc4+zWHr9Zk2ArTs+wl
ZWyHCbhNwt/2H+vyug+9AwJgJVXjBHqWmMubMITyw//1LX+ti0QCYaL+o5yiQTUI
4sWXfjqQwjaJvulBbfVaFoivfjXb50pmxk16BDy1x8zmIo5mGtB5lRjraFRWJP0b
Pqdhtu7vkfe8k4hWR9qkHEEUe/39CoQZcEPcmiggHe8lXnqhyJ4svej45dT7Tabm
NqwEutecApWsLrpaK2AZpEh6flX4KnkCggEBAJdICoVNsQasg6hAIEdUjMQXm8Mc
mXDLCi8P4V01RhJlAAASjpQ2a46+fUvCLinSMwOzPRDj46D/8fw+F0poRahRYlk+
W2oM8DPmU8+HrJghsxGicU3fOrDlalttwzxDxuazCTwO3kNpAjNRc0YbaGhwb4uK
OZjMtC8BUrOnKAXhw1sEipMUnN79lH+W3YiMfltpAAp2m1Owusfu1nMBkGMcHRT/
T4jF02rgY3sx63LzVvPSRm6Qg638jUuQPS+yxmwGHa3Z4409DxB0yPoq3OW4bPhO
j/k9QLXdABqMYL6F14Am2fcuRDofCBgekbfn1fh3Cdmf8YMxGZWWWWoE3tE=
-----END RSA PRIVATE KEY-----

16
authentik/compose.env Normal file
View File

@@ -0,0 +1,16 @@
COMPOSE_PORT_HTTP=62751
COMPOSE_PORT_HTTPS=62752
PG_PASS=7n7mXBhgI2wOUm1CAEErgbnWX7wK9fNn6wXH2eVnZSfadUEt
AUTHENTIK_SECRET_KEY=3R85z4JsPEKLKSFi+oxaoKypRlFkGctjElmNSiLzyafKlWfcRr+Y62yHfTBfedY19pv2fswhGL2F8TbU
AUTHENTIK_BOOTSTRAP_EMAIL=admin@delmar.bzh
AUTHENTIK_BOOTSTRAP_PASSWORD=X5r53JMPVg97EKfL
AUTHENTIK_BOOTSTRAP_TOKEN=rzDMUWQOxOWQIYXPcVY2XKlwgTau4vOSfaSfVYsLWQQSUUITAVDY3lqwvoTbUMVD
AUTHENTIK_ERROR_REPORTING__ENABLED=true
AUTHENTIK_EMAIL__HOST=pro1.mail.ovh.net
AUTHENTIK_EMAIL__PORT=587
AUTHENTIK_EMAIL__USERNAME=admin@delmar.bzh
AUTHENTIK_EMAIL__PASSWORD=sxS4GA8rBfmFkCFL
AUTHENTIK_EMAIL__USE_TLS=true
AUTHENTIK_EMAIL__USE_SSL=false
AUTHENTIK_EMAIL__TIMEOUT=10
AUTHENTIK_EMAIL__FROM=admin@delmar.bzh

95
authentik/compose.yaml Normal file
View File

@@ -0,0 +1,95 @@
volumes:
database:
redis:
services:
postgresql:
container_name: authentik_postgres
image: docker.io/library/postgres:16-alpine
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
start_period: 20s
interval: 30s
retries: 5
timeout: 5s
volumes:
- database:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: ${PG_PASS:?database password required}
POSTGRES_USER: ${PG_USER:-authentik}
POSTGRES_DB: ${PG_DB:-authentik}
# env_file:
# - compose.env
redis:
container_name: authentik_redis
image: docker.io/library/redis:alpine
command: --save 60 1 --loglevel warning
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
start_period: 20s
interval: 30s
retries: 5
timeout: 3s
volumes:
- redis:/data
server:
container_name: authentik_server
image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2025.4.0}
restart: unless-stopped
command: server
environment:
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY:?secret key required}
AUTHENTIK_REDIS__HOST: redis
AUTHENTIK_POSTGRESQL__HOST: postgresql
AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
volumes:
- ./media:/media
- ./custom-templates:/templates
# env_file:
# - compose.env
ports:
- "${COMPOSE_PORT_HTTP:-9000}:9000"
- "${COMPOSE_PORT_HTTPS:-9443}:9443"
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
worker:
container_name: authentik_worker
image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2025.4.0}
restart: unless-stopped
command: worker
environment:
AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY:?secret key required}
AUTHENTIK_REDIS__HOST: redis
AUTHENTIK_POSTGRESQL__HOST: postgresql
AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
# `user: root` and the docker socket volume are optional.
# See more for the docker socket integration here:
# https://goauthentik.io/docs/outposts/integrations/docker
# Removing `user: root` also prevents the worker from fixing the permissions
# on the mounted folders, so when removing this make sure the folders have the correct UID/GID
# (1000:1000 by default)
user: root
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./media:/media
- ./certs:/certs
- ./custom-templates:/templates
# env_file:
# - compose.env
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy

2
authentik/nextcloud.txt Normal file
View File

@@ -0,0 +1,2 @@
Rr23j09gXB66exXkRg8GK0Yc8XvTM9wZc1jc30MV
AZvPpQLKhUrLVZwpczXeCkQvi2tipsX1pcMgIYzD23TZ5bCNUo9warxrRxduFTXUo9tG3bIpyDying2ei2pUuJPbm3LJbuONydJsLa15Dtns6yjsIfK4sgfShRmGltUu

65
bash/docker-volumes.sh Normal file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
#
# The docker-export and docker-commit/docker-save commands do not save the container volumes.
# Use this script to save and load the container volumes.
#
# v1.8 by Ricardo Branco
#
# NOTES:
# + This script could have been written in Python or Go, but the tarfile module and the tar package
# lack support for writing sparse files.
# + We use the Ubuntu 22.04 Docker image with tar v1.29 that uses SEEK_DATA/SEEK_HOLE to manage sparse files.
#
verbose=""
if [[ $1 == "-v" || $1 == "--verbose" ]] ; then
verbose="-v"
shift
fi
if [[ $# -ne 3 || ! $2 =~ ^(save|load)$ ]] ; then
echo "Usage: $0 [-v|--verbose] CONTAINER [save|load] TARBALL" >&2
exit 1
fi
IMAGE="ubuntu:22.04"
# Set DOCKER=podman if you want to use podman.io instead of docker
DOCKER=${DOCKER:-"docker"}
get_volumes () {
$DOCKER inspect --type container -f '{{range .Mounts}}{{printf "%v\x00" .Destination}}{{end}}' "$CONTAINER" | head -c -1 | sort -uz
}
save_volumes () {
if [ -f "$TAR_FILE" ] ; then
echo "ERROR: $TAR_FILE already exists" >&2
exit 1
fi
umask 077
# Create a void tar file to avoid mounting its directory as a volume
touch -- "$TAR_FILE"
tmp_dir=$(mktemp -du -p /)
get_volumes | $DOCKER run --rm -i --volumes-from "$CONTAINER" -e LC_ALL=C.UTF-8 -v "$TAR_FILE:/${tmp_dir}/${TAR_FILE##*/}" $IMAGE tar -c -a $verbose --null -T- -f "/${tmp_dir}/${TAR_FILE##*/}"
}
load_volumes () {
if [ ! -f "$TAR_FILE" ] ; then
echo "ERROR: $TAR_FILE doesn't exist in the current directory" >&2
exit 1
fi
tmp_dir=$(mktemp -du -p /)
$DOCKER run --rm --volumes-from "$CONTAINER" -e LC_ALL=C.UTF-8 -v "$TAR_FILE:/${tmp_dir}/${TAR_FILE##*/}":ro $IMAGE tar -xp $verbose -S -f "/${tmp_dir}/${TAR_FILE##*/}" -C / --overwrite
}
CONTAINER="$1"
TAR_FILE=$(readlink -f "$3")
set -e
case "$2" in
save)
save_volumes ;;
load)
load_volumes ;;
esac

View File

@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -e
# Function to preserve and update container
preserve_and_update_container() {
local container=$1
local image=$(docker inspect --format '{{.Config.Image}}' "$container")
# Pull the latest image version
docker pull $image
# Compare image IDs to determine if an update is needed
local latest_image_id=$(docker inspect --format '{{.Id}}' $image)
local container_image_id=$(docker inspect --format '{{.Image}}' "$container")
if [[ "$latest_image_id" != "$container_image_id" ]]; then
echo "Updating $container..."
# Capture current configurations
local env_vars=$(docker inspect $container --format '{{range .Config.Env}}{{println .}}{{end}}')
local volumes=$(docker inspect $container --format '{{range .Mounts}}{{println .Source ":" .Destination}}{{end}}')
local network=$(docker network ls --filter id=$(docker inspect $container --format '{{.HostConfig.NetworkMode}}') --format '{{.Name}}')
# Remove the outdated container
docker rm -f $container
# Recreate the container with the same configurations
docker run -d --name $container $(echo "$env_vars" | xargs -I {} echo --env '{}') $(echo "$volumes" | xargs -I {} echo -v '{}') --network="$network" $image
echo "$container updated successfully."
else
echo "$container is already up to date."
fi
}
# Iterate over all running containers
for container in $(docker ps --format "{{.Names}}"); do
preserve_and_update_container $container
done
echo "Container update check complete while preserving existing container configurations."

57
bracket/compose.yaml Normal file
View File

@@ -0,0 +1,57 @@
volumes:
bracket_static:
bracket_pg_data:
services:
bracket-frontend:
container_name: bracket-frontend
image: ghcr.io/evroon/bracket-frontend
environment:
NODE_ENV: "production"
NEXT_PUBLIC_API_BASE_URL: http://localhost:8400
# NEXT_PUBLIC_HCAPTCHA_SITE_KEY: 10000000-ffff-ffff-ffff-000000000001
ports:
- "3000:3000"
restart: unless-stopped
bracket-backend:
container_name: bracket-backend
image: ghcr.io/evroon/bracket-backend
depends_on:
- postgres
environment:
ENVIRONMENT: "PRODUCTION"
CORS_ORIGINS: http://localhost:3000
PG_DSN: "postgresql://admin:rLAPG2RDeozyfgxr@postgres:5432/bracket_db"
JWT_SECRET: 4GEpdr4rFTcR637M
ADMIN_EMAIL: ${ADMIN_EMAIL}
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
ALLOW_USER_REGISTRATION: true
AUTO_RUN_MIGRATIONS: true
ports:
- "8400:8400"
restart: unless-stopped
volumes:
- bracket_static:/app/static
postgres:
container_name: bracket-postgres
image: postgres
environment:
POSTGRES_DB: bracket_db
POSTGRES_PASSWORD: rLAPG2RDeozyfgxr
POSTGRES_USER: admin
restart: always
volumes:
- bracket_pg_data:/var/lib/postgresql/data
adminer:
container_name: adminer
image: adminer
environment:
ADMINER_DEFAULT_SERVER: postgres
depends_on:
- postgres
ports:
- 63880:8080
restart: unless-stopped

23
caddymanager/.env Normal file
View File

@@ -0,0 +1,23 @@
# Backend
API_BASE_URL=http://localhost:3000/api/v1
APP_NAME=Caddy Manager
DARK_MODE=true
# Frontend
PORT=3000
# Database Engine Configuration
DB_ENGINE=sqlite # Options: 'sqlite' or 'mongodb'
# SQLite Configuration (used when DB_ENGINE=sqlite)
SQLITE_DB_PATH=./caddymanager.sqlite
# MongoDB Configuration (used when DB_ENGINE=mongodb)
MONGO_USERNAME=mongoadmin
MONGO_PASSWORD=QaG33feoWfL2W7F9AuRYTS2N4Bm94hEA
MONGODB_URI=mongodb://mongoadmin:QaG33feoWfL2W7F9AuRYTS2N4Bm94hEA@localhost:27017/caddymanager?authSource=admin
CORS_ORIGIN=http://localhost:5173
LOG_LEVEL=debug
CADDY_SANDBOX_URL=http://localhost:2019
PING_INTERVAL=30000
PING_TIMEOUT=2000
AUDIT_LOG_MAX_SIZE_MB=100
AUDIT_LOG_RETENTION_DAYS=90
JWT_SECRET=YPKCVW8qEEshVN6BHPb6tq4YdhQpdQrR
JWT_EXPIRATION=24h

View File

@@ -0,0 +1,84 @@
# bob
# https://github.com/caddymanager
---
name: caddymanager
networks:
caddymanager:
driver: bridge
volumes:
mongodb_data: # Only used when MongoDB profile is active
sqlite_data: # SQLite database storage
services:
# MongoDB database for persistent storage (optional - SQLite is used by default)
mongodb:
image: mongo:8.0
container_name: caddymanager-mongodb
restart: unless-stopped
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME:-mongoadmin}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD:-someSecretPassword} # Change for production!
ports:
- "27017:27017" # Expose for local dev, remove for production
volumes:
- mongodb_data:/data/db
networks:
- caddymanager
profiles:
- mongodb # Use 'docker-compose --profile mongodb up' to include MongoDB
# Backend API server
backend:
image: caddymanager/caddymanager-backend:latest
container_name: caddymanager-backend
restart: unless-stopped
environment:
- PORT=3000
# Database Engine Configuration (defaults to SQLite)
- DB_ENGINE=sqlite # Options: 'sqlite' or 'mongodb'
# SQLite Configuration (used when DB_ENGINE=sqlite)
- SQLITE_DB_PATH=/app/data/caddymanager.sqlite
# MongoDB Configuration (used when DB_ENGINE=mongodb)
- MONGODB_URI=mongodb://$${MONGO_USERNAME:-mongoadmin}:$${MONGO_PASSWORD:-someSecretPassword}@mongodb:27017/caddymanager?authSource=admin
- CORS_ORIGIN=http://localhost:80
- LOG_LEVEL=debug
- CADDY_SANDBOX_URL=http://localhost:2019
- PING_INTERVAL=30000
- PING_TIMEOUT=2000
- AUDIT_LOG_MAX_SIZE_MB=100
- AUDIT_LOG_RETENTION_DAYS=90
- METRICS_HISTORY_MAX=1000 # Optional: max number of in-memory metric history snapshots to keep
- JWT_SECRET=YPKCVW8qEEshVN6BHPb6tq4YdhQpdQrR
- JWT_EXPIRATION=24h
# Backend is now only accessible through frontend proxy
volumes:
- sqlite_data:/app/data # SQLite database storage
networks:
- caddymanager
# Frontend web UI
frontend:
image: caddymanager/caddymanager-frontend:latest
container_name: caddymanager-frontend
restart: unless-stopped
depends_on:
- backend
environment:
- BACKEND_HOST=backend:3000
- APP_NAME=Caddy Manager
- DARK_MODE=true
ports:
# - "80:80" # Expose web UI
- 20125:80
networks:
- caddymanager
# Notes:
# - SQLite is the default database engine - no additional setup required!
# - To use MongoDB instead, set DB_ENGINE=mongodb and start with: docker-compose --profile mongodb up
# - For production, use strong passwords and consider secrets management.
# - The backend uses SQLite by default, storing data in a persistent volume.
# - The frontend proxies all /api/* requests to the backend service.
# - Backend is not directly exposed - all API access goes through the frontend proxy.

View File

@@ -0,0 +1,57 @@
networks:
calibre:
volumes:
config:
name: calibre_config
external: true
uploads:
name: calibre_uploads
external: true
plugins:
name: calibre_plugins
external: true
calibre-web:
name: calibre_calibre-web
external: true
services:
calibre:
image: ghcr.io/linuxserver/calibre
container_name: calibre
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Paris
- CUSTOM_USER=admin
- PASSWORD=Z2Mi&S5krN@P9P
volumes:
- config:/config
- uploads:/uploads
- plugins:/plugins
- /nfs/ebooks/calibre_library:/books
ports:
- 8080:8080
- 8081:8081
labels:
- com.centurylinklabs.watchtower.enable=true
calibre-web:
image: ghcr.io/linuxserver/calibre-web
container_name: calibre-web
restart: unless-stopped
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Paris
volumes:
- calibre-web:/config
- /nfs/ebooks/calibre_library:/books
depends_on:
- calibre
ports:
- 8083:8083
labels:
- com.centurylinklabs.watchtower.enable=true

7
coturn/compose.env Normal file
View File

@@ -0,0 +1,7 @@
SUBDOMAIN=cloud
DOMAIN=delmar.bzh
EXTERNAL_IP=192.168.1.14
STATIC_AUTH_SECRET=Jxge85wCdu6y42nZ
LISTENING_PORT=3478
MIN_PORT=49160
MAX_PORT=49200

24
coturn/compose.yaml Normal file
View File

@@ -0,0 +1,24 @@
## To be included in nextcloud.compose.yaml
services:
coturn:
image: instrumentisto/coturn:latest
container_name: coturn
restart: unless-stopped
ports:
- 3478:3478
- 49160-49200:49160-49200/udp
command:
- '--realm=cloud.delmar.bzh'
- '--server-name=turn-server'
- '--fingerprint'
- '--listening-ip=0.0.0.0'
- '--external-ip=192.168.1.14'
- '--listening-port=3478'
- '--min-port=49160'
- '--max-port=49200'
- '--log-file=/var/log/turnserver.log'
- '--tls-listening-port=443'
- '--use-auth-secret'
- '--static-auth-secret=Jxge85wCdu6y42nZ'
networks:
- nextcloud

36
coturn/compose.yaml.old Normal file
View File

@@ -0,0 +1,36 @@
volumes:
services:
coturn:
image: instrumentisto/coturn:latest
container_name: coturn
restart: unless-stopped
ports:
- '${LISTENING_PORT}:${LISTENING_PORT}'
- '${MIN_PORT}-${MAX_PORT}:${MIN_PORT}-${MAX_PORT}/udp'
command:
- '--realm=${SUBDOMAIN}.${DOMAIN}'
- '--server-name=turn-server'
- '--fingerprint'
- '--listening-ip=0.0.0.0'
- '--external-ip=${EXTERNAL_IP}'
- '--listening-port=${LISTENING_PORT}'
- '--min-port=${MIN_PORT}'
- '--max-port=${MAX_PORT}'
- '--log-file=/var/log/turnserver.log'
- '--tls-listening-port=443'
- '--use-auth-secret'
- '--static-auth-secret=${STATIC_AUTH_SECRET}'
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.turn-server.tls=true'
- 'traefik.http.routers.turn-server.rule=Host(`${SUBDOMAIN}.${DOMAIN}`)'
- 'traefik.http.routers.turn-server.entrypoints=websecure'
- 'traefik.http.routers.turn-server.tls.certresolver=letsencrypt'
networks:
- 'web'
networks:
web:
external: true

10
crater/.dockerignore Normal file
View File

@@ -0,0 +1,10 @@
.dockerignore
.gitignore
*.md
.git/
.idea/
.DS_Store/
docker-compose.*
LICENSE
nginx.conf
yarn.lock

25
crater/.editorconfig Normal file
View File

@@ -0,0 +1,25 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.yml]
indent_style = space
indent_size = 2
[*.vue]
indent_size = 2
[*.js]
indent_size = 2
[*.json]
indent_size = 2

40
crater/.env.example Normal file
View File

@@ -0,0 +1,40 @@
APP_ENV=production
APP_KEY=base64:kgk/4DW1vEVy7aEvet5FPp5un6PIGe/so8H0mvoUtW0=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://crater.test
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=crater
DB_USERNAME=crater
DB_PASSWORD="crater"
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_DRIVER=sync
SESSION_DRIVER=cookie
SESSION_LIFETIME=1440
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
PUSHER_APP_ID=
PUSHER_KEY=
PUSHER_SECRET=
SANCTUM_STATEFUL_DOMAINS=crater.test
SESSION_DOMAIN=crater.test
TRUSTED_PROXIES="*"
CRON_JOB_AUTH_TOKEN=""

13
crater/.env.testing Normal file
View File

@@ -0,0 +1,13 @@
APP_ENV=testing
APP_DEBUG=true
APP_KEY=base64:IdDlpLmYyWA9z4Ruj5st1FSYrhCR7lPOscLGCz2Jf4I=
DB_CONNECTION=sqlite
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=ff538f0e1037f4
MAIL_PASSWORD=c04c81145fcb73
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="admin@craterapp.com"
MAIL_FROM_NAME="John Doe"

14
crater/.eslintrc.js Normal file
View File

@@ -0,0 +1,14 @@
// .eslintrc.js
module.exports = {
extends: [
// add more generic rulesets here, such as:
// 'eslint:recommended',
"plugin:vue/vue3-recommended",
"prettier",
],
rules: {
// override/add rules settings here, such as:
// 'vue/no-unused-vars': 'error'
},
};

3
crater/.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored

20
crater/.gitignore vendored Normal file
View File

@@ -0,0 +1,20 @@
/Modules
/node_modules
/public/storage
/public/hot
/storage/*.key
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
.phpunit.result.cache
.rnd
/.expo
/.vscode
/docker-compose/db/data/
.gitkeep
/public/docs
/.scribe
!storage/fonts/.gitkeep
.DS_Store

View File

@@ -0,0 +1,42 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude(['bootstrap', 'storage', 'vendor'])
->name('*.php')
->name('_ide_helper')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
$rules = [
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'concat_space' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'class_attributes_separation' => [
'elements' => [
'method' => 'one',
'property' => 'one',
],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
];
return (new PhpCsFixer\Config())
->setUsingCache(true)
->setRules($rules)
->setFinder($finder);

5
crater/.prettierrc.json Normal file
View File

@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2
}

128
crater/CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
info@craterapp.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

40
crater/Dockerfile Normal file
View File

@@ -0,0 +1,40 @@
FROM php:8.1-fpm
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
libzip-dev \
libmagickwand-dev \
mariadb-client
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pecl install imagick \
&& docker-php-ext-enable imagick
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath gd
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
chown -R $user:$user /home/$user
# Set working directory
WORKDIR /var/www
USER $user

661
crater/LICENSE Normal file
View File

@@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

5
crater/SECURITY.md Normal file
View File

@@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
Please email security@craterapp.com to report any security vulnerabilities. We will acknowledge receipt of your vulnerability and strive to send you regular updates about our progress. If you're curious about the status of your disclosure please feel free to email us again.

13267
crater/_ide_helper.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
<?php
namespace Crater\Console\Commands;
use Carbon\Carbon;
use Crater\Models\Estimate;
use Illuminate\Console\Command;
class CheckEstimateStatus extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'check:estimates:status';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Check invoices status.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$date = Carbon::now();
$status = [Estimate::STATUS_ACCEPTED, Estimate::STATUS_REJECTED, Estimate::STATUS_EXPIRED];
$estimates = Estimate::whereNotIn('status', $status)->whereDate('expiry_date', '<', $date)->get();
foreach ($estimates as $estimate) {
$estimate->status = Estimate::STATUS_EXPIRED;
printf("Estimate %s is EXPIRED \n", $estimate->estimate_number);
$estimate->save();
}
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Crater\Console\Commands;
use Carbon\Carbon;
use Crater\Models\Invoice;
use Illuminate\Console\Command;
class CheckInvoiceStatus extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'check:invoices:status';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Check invoices status.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$date = Carbon::now();
$invoices = Invoice::whereNotIn('status', [Invoice::STATUS_COMPLETED, Invoice::STATUS_DRAFT])
->where('overdue', false)
->whereDate('due_date', '<', $date)
->get();
foreach ($invoices as $invoice) {
$invoice->overdue = true;
printf("Invoice %s is OVERDUE \n", $invoice->invoice_number);
$invoice->save();
}
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace Crater\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
class CreateTemplateCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'make:template {name} {--type=}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create estimate or invoice pdf template. ';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$templateName = $this->argument('name');
$type = $this->option('type');
if (! $type) {
$type = $this->choice('Create a template for?', ['invoice', 'estimate']);
}
if (Storage::disk('views')->exists("/app/pdf/{$type}/{$templateName}.blade.php")) {
$this->info("Template with given name already exists.");
return 0;
}
Storage::disk('views')->copy("/app/pdf/{$type}/{$type}1.blade.php", "/app/pdf/{$type}/{$templateName}.blade.php");
copy(public_path("/build/img/PDF/{$type}1.png"), public_path("/build/img/PDF/{$templateName}.png"));
copy(resource_path("/static/img/PDF/{$type}1.png"), resource_path("/static/img/PDF/{$templateName}.png"));
$path = resource_path("views/app/pdf/{$type}/{$templateName}.blade.php");
$type = ucfirst($type);
$this->info("{$type} Template created successfully at ".$path);
return 0;
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace Crater\Console\Commands;
use Crater\Space\ModuleInstaller;
use Illuminate\Console\Command;
class InstallModuleCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'install:module {module} {version}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Install cloned module.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
ModuleInstaller::complete($this->argument('module'), $this->argument('version'));
return Command::SUCCESS;
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace Crater\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Support\Facades\Artisan;
class ResetApp extends Command
{
use ConfirmableTrait;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'reset:app {--force}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Clean database, database_created and public/storage folder';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return;
}
$this->info('Running migrate:fresh');
Artisan::call('migrate:fresh --seed --force');
$this->info('Seeding database');
Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]);
$path = base_path('.env');
if (file_exists($path)) {
file_put_contents($path, str_replace(
'APP_DEBUG=true',
'APP_DEBUG=false',
file_get_contents($path)
));
}
$this->info('App has been reset successfully');
}
}

View File

@@ -0,0 +1,241 @@
<?php
namespace Crater\Console\Commands;
use Crater\Models\Setting;
use Crater\Space\Updater;
use Illuminate\Console\Command;
// Implementation taken from Akaunting - https://github.com/akaunting/akaunting
class UpdateCommand extends Command
{
public $installed;
public $version;
public $response;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'crater:update';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Automatically update your crater app';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
set_time_limit(3600); // 1 hour
$this->installed = $this->getInstalledVersion();
$this->response = $this->getLatestVersionResponse();
$this->version = ($this->response) ? $this->response->version : false;
if ($this->response == 'extension_required') {
$this->info('Sorry! Your system does not meet the minimum requirements for this update.');
$this->info('Please retry after installing the required version/extensions.');
return;
}
if (! $this->version) {
$this->info('No Update Available! You are already on the latest version.');
return;
}
if (! $this->confirm("Do you wish to update to {$this->version}?")) {
return;
}
if (! $path = $this->download()) {
return;
}
if (! $path = $this->unzip($path)) {
return;
}
if (! $this->copyFiles($path)) {
return;
}
if (isset($this->response->deleted_files) && ! empty($this->response->deleted_files)) {
if (! $this->deleteFiles($this->response->deleted_files)) {
return;
}
}
if (! $this->migrateUpdate()) {
return;
}
if (! $this->finish()) {
return;
}
$this->info('Successfully updated to '.$this->version);
}
public function getInstalledVersion()
{
return Setting::getSetting('version');
}
public function getLatestVersionResponse()
{
$this->info('Your currently installed version is '.$this->installed);
$this->line('');
$this->info('Checking for update...');
try {
$response = Updater::checkForUpdate($this->installed);
if ($response->success) {
$extensions = $response->version->extensions;
$is_required = false;
foreach ($extensions as $key => $extension) {
if (! $extension) {
$is_required = true;
$this->info('❌ '.$key);
}
$this->info('✅ '.$key);
}
if ($is_required) {
return 'extension_required';
}
return $response->version;
}
return false;
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
}
public function download()
{
$this->info('Downloading update...');
try {
$path = Updater::download($this->version, 1);
if (! is_string($path)) {
$this->error('Download exception');
return false;
}
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return $path;
}
public function unzip($path)
{
$this->info('Unzipping update package...');
try {
$path = Updater::unzip($path);
if (! is_string($path)) {
$this->error('Unzipping exception');
return false;
}
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return $path;
}
public function copyFiles($path)
{
$this->info('Copying update files...');
try {
Updater::copyFiles($path);
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return true;
}
public function deleteFiles($files)
{
$this->info('Deleting unused old files...');
try {
Updater::deleteFiles($files);
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return true;
}
public function migrateUpdate()
{
$this->info('Running Migrations...');
try {
Updater::migrateUpdate();
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return true;
}
public function finish()
{
$this->info('Finishing update...');
try {
Updater::finishUpdate($this->installed, $this->version);
} catch (\Exception $e) {
$this->error($e->getMessage());
return false;
}
return true;
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Crater\Console;
use Crater\Models\CompanySetting;
use Crater\Models\RecurringInvoice;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\ResetApp::class,
Commands\UpdateCommand::class,
Commands\CreateTemplateCommand::class,
Commands\InstallModuleCommand::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
if (\Storage::disk('local')->has('database_created')) {
$schedule->command('check:invoices:status')
->daily();
$schedule->command('check:estimates:status')
->daily();
$recurringInvoices = RecurringInvoice::where('status', 'ACTIVE')->get();
foreach ($recurringInvoices as $recurringInvoice) {
$timeZone = CompanySetting::getSetting('time_zone', $recurringInvoice->company_id);
$schedule->call(function () use ($recurringInvoice) {
$recurringInvoice->generateInvoice();
})->cron($recurringInvoice->frequency)->timezone($timeZone);
}
}
}
/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Crater\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ModuleDisabledEvent
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $module;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($module)
{
$this->module = $module;
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Crater\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ModuleEnabledEvent
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $module;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($module)
{
$this->module = $module;
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Crater\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ModuleInstalledEvent
{
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $module;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($module)
{
$this->module = $module;
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Crater\Events;
use Illuminate\Foundation\Events\Dispatchable;
class UpdateFinished
{
use Dispatchable;
public $new;
public $old;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($old, $new)
{
$this->old = $old;
$this->new = $new;
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace Crater\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Throwable $exception
* @return void
*/
public function report(Throwable $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace Crater\Generators;
use Crater\Models\Estimate;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibrary\Support\PathGenerator\PathGenerator;
class CustomPathGenerator implements PathGenerator
{
public function getPath(Media $media): string
{
return $this->getBasePath($media).'/';
}
public function getPathForConversions(Media $media): string
{
return $this->getBasePath($media).'/conversations/';
}
public function getPathForResponsiveImages(Media $media): string
{
return $this->getBasePath($media).'/responsive-images/';
}
/*
* Get a unique base path for the given media.
*/
protected function getBasePath(Media $media): string
{
$folderName = null;
if ($media->model_type == Invoice::class) {
$folderName = 'Invoices';
} elseif ($media->model_type == Estimate::class) {
$folderName = 'Estimates';
} elseif ($media->model_type == Payment::class) {
$folderName = 'Payments';
} else {
$folderName = $media->getKey();
}
return $folderName;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Crater\Http\Controllers;
use Crater\Models\Setting;
use Illuminate\Http\Request;
class AppVersionController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$version = Setting::getSetting('version');
return response()->json([
'version' => $version,
]);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace Crater\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
/**
* Get the response for a successful password reset link.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResetLinkResponse(Request $request, $response)
{
return response()->json([
'message' => 'Password reset email sent.',
'data' => $response,
]);
}
/**
* Get the response for a failed password reset link.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResetLinkFailedResponse(Request $request, $response)
{
return response()->json([
'error' => 'Email could not be sent to this email address.'
], 403);
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Models\User;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => $data['password'],
]);
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Get the response for a successful password reset.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResetResponse(Request $request, $response)
{
return response()->json([
'message' => 'Password reset successfully.',
]);
}
/**
* Reset the given user's password.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
* @param string $password
* @return void
*/
protected function resetPassword($user, $password)
{
$user->password = $password;
$user->setRememberToken(Str::random(60));
$user->save();
event(new PasswordReset($user));
}
/**
* Get the response for a failed password reset.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResetFailedResponse(Request $request, $response)
{
return response('Failed, Invalid Token.', 403);
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Auth;
use Crater\Http\Controllers\Controller;
use Crater\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@@ -0,0 +1,22 @@
<?php
// Implementation taken from nova-backup-tool - https://github.com/spatie/nova-backup-tool/
namespace Crater\Http\Controllers\V1\Admin\Backup;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
class ApiController extends Controller
{
/**
*
* @return JsonResponse
*/
public function respondSuccess(): JsonResponse
{
return response()->json([
'success' => true,
]);
}
}

View File

@@ -0,0 +1,99 @@
<?php
// Implementation taken from nova-backup-tool - https://github.com/spatie/nova-backup-tool/
namespace Crater\Http\Controllers\V1\Admin\Backup;
use Crater\Jobs\CreateBackupJob;
use Crater\Rules\Backup\PathToZip;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Spatie\Backup\BackupDestination\Backup;
use Spatie\Backup\BackupDestination\BackupDestination;
use Spatie\Backup\Helpers\Format;
class BackupsController extends ApiController
{
/**
* Display a listing of the resource.
*
* @return JsonResponse
*/
public function index(Request $request)
{
$this->authorize('manage backups');
$configuredBackupDisks = config('backup.backup.destination.disks');
try {
$backupDestination = BackupDestination::create(config('filesystems.default'), config('backup.backup.name'));
$backups = Cache::remember("backups-{$request->file_disk_id}", now()->addSeconds(4), function () use ($backupDestination) {
return $backupDestination
->backups()
->map(function (Backup $backup) {
return [
'path' => $backup->path(),
'created_at' => $backup->date()->format('Y-m-d H:i:s'),
'size' => Format::humanReadableSize($backup->size()),
];
})
->toArray();
});
return response()->json([
'backups' => $backups,
'disks' => $configuredBackupDisks,
]);
} catch (\Exception $e) {
return response()->json([
'backups' => [],
'error' => 'invalid_disk_credentials',
'error_message' => $e->getMessage(),
'disks' => $configuredBackupDisks,
]);
}
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return JsonResponse
*/
public function store(Request $request)
{
$this->authorize('manage backups');
dispatch(new CreateBackupJob($request->all()))->onQueue(config('backup.queue.name'));
return $this->respondSuccess();
}
/**
* Remove the specified resource from storage.
*
* @param \Illuminate\Http\Request $request
* @return JsonResponse
*/
public function destroy($disk, Request $request)
{
$this->authorize('manage backups');
$validated = $request->validate([
'path' => ['required', new PathToZip()],
]);
$backupDestination = BackupDestination::create(config('filesystems.default'), config('backup.backup.name'));
$backupDestination
->backups()
->first(function (Backup $backup) use ($validated) {
return $backup->path() === $validated['path'];
})
->delete();
return $this->respondSuccess();
}
}

View File

@@ -0,0 +1,59 @@
<?php
// Implementation taken from nova-backup-tool - https://github.com/spatie/nova-backup-tool/
namespace Crater\Http\Controllers\V1\Admin\Backup;
use Crater\Rules\Backup\PathToZip;
use Illuminate\Http\Request;
use Spatie\Backup\BackupDestination\Backup;
use Spatie\Backup\BackupDestination\BackupDestination;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
class DownloadBackupController extends ApiController
{
public function __invoke(Request $request)
{
$this->authorize('manage backups');
$validated = $request->validate([
'path' => ['required', new PathToZip()],
]);
$backupDestination = BackupDestination::create(config('filesystems.default'), config('backup.backup.name'));
$backup = $backupDestination->backups()->first(function (Backup $backup) use ($validated) {
return $backup->path() === $validated['path'];
});
if (! $backup) {
return response('Backup not found', Response::HTTP_UNPROCESSABLE_ENTITY);
}
return $this->respondWithBackupStream($backup);
}
public function respondWithBackupStream(Backup $backup): StreamedResponse
{
$fileName = pathinfo($backup->path(), PATHINFO_BASENAME);
$downloadHeaders = [
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
'Content-Type' => 'application/zip',
'Content-Length' => $backup->size(),
'Content-Disposition' => 'attachment; filename="'.$fileName.'"',
'Pragma' => 'public',
];
return response()->stream(function () use ($backup) {
$stream = $backup->stream();
fpassthru($stream);
if (is_resource($stream)) {
fclose($stream);
}
}, 200, $downloadHeaders);
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Company;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\CompaniesRequest;
use Crater\Http\Resources\CompanyResource;
use Crater\Models\Company;
use Crater\Models\User;
use Illuminate\Http\Request;
use Silber\Bouncer\BouncerFacade;
use Vinkla\Hashids\Facades\Hashids;
class CompaniesController extends Controller
{
public function store(CompaniesRequest $request)
{
$this->authorize('create company');
$user = $request->user();
$company = Company::create($request->getCompanyPayload());
$company->unique_hash = Hashids::connection(Company::class)->encode($company->id);
$company->save();
$company->setupDefaultData();
$user->companies()->attach($company->id);
$user->assign('super admin');
if ($request->address) {
$company->address()->create($request->address);
}
return new CompanyResource($company);
}
public function destroy(Request $request)
{
$company = Company::find($request->header('company'));
$this->authorize('delete company', $company);
$user = $request->user();
if ($request->name !== $company->name) {
return respondJson('company_name_must_match_with_given_name', 'Company name must match with given name');
}
if ($user->loadCount('companies')->companies_count <= 1) {
return respondJson('You_cannot_delete_all_companies', 'You cannot delete all companies');
}
$company->deleteCompany($user);
return response()->json([
'success' => true
]);
}
public function transferOwnership(Request $request, User $user)
{
$company = Company::find($request->header('company'));
$this->authorize('transfer company ownership', $company);
if ($user->hasCompany($company->id)) {
return response()->json([
'success' => false,
'message' => 'User does not belongs to this company.'
]);
}
$company->update(['owner_id' => $user->id]);
BouncerFacade::sync($user)->roles(['super admin']);
return response()->json([
'success' => true
]);
}
public function getUserCompanies(Request $request)
{
$companies = $request->user()->companies;
return CompanyResource::collection($companies);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Company;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\CompanyResource;
use Crater\Models\Company;
use Illuminate\Http\Request;
class CompanyController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$company = Company::find($request->header('company'));
return new CompanyResource($company);
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Config;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\Request;
class FiscalYearsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
return response()->json([
'fiscal_years' => config('crater.fiscal_years'),
]);
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Config;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\Request;
class LanguagesController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
return response()->json([
'languages' => config('crater.languages'),
]);
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Config;
use Crater\Http\Controllers\Controller;
use Illuminate\Http\Request;
class RetrospectiveEditsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
return response()->json([
'retrospective_edits' => config('crater.retrospective_edits'),
]);
}
}

View File

@@ -0,0 +1,96 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\CustomField;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\CustomFieldRequest;
use Crater\Http\Resources\CustomFieldResource;
use Crater\Models\CustomField;
use Illuminate\Http\Request;
class CustomFieldsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$this->authorize('viewAny', CustomField::class);
$limit = $request->has('limit') ? $request->limit : 5;
$customFields = CustomField::applyFilters($request->all())
->whereCompany()
->latest()
->paginateData($limit);
return CustomFieldResource::collection($customFields);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\CustomFieldRequest $request
* @return \Illuminate\Http\Response
*/
public function store(CustomFieldRequest $request)
{
$this->authorize('create', CustomField::class);
$customField = CustomField::createCustomField($request);
return new CustomFieldResource($customField);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show(CustomField $customField)
{
$this->authorize('view', $customField);
return new CustomFieldResource($customField);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(CustomFieldRequest $request, CustomField $customField)
{
$this->authorize('update', $customField);
$customField->updateCustomField($request);
return new CustomFieldResource($customField);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(CustomField $customField)
{
$this->authorize('delete', $customField);
if ($customField->customFieldValues()->exists()) {
$customField->customFieldValues()->delete();
}
$customField->forceDelete();
return response()->json([
'success' => true,
]);
}
}

View File

@@ -0,0 +1,142 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Customer;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\CustomerResource;
use Crater\Models\CompanySetting;
use Crater\Models\Customer;
use Crater\Models\Expense;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Illuminate\Http\Request;
class CustomerStatsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Customer $customer)
{
$this->authorize('view', $customer);
$i = 0;
$months = [];
$invoiceTotals = [];
$expenseTotals = [];
$receiptTotals = [];
$netProfits = [];
$monthCounter = 0;
$fiscalYear = CompanySetting::getSetting('fiscal_year', $request->header('company'));
$startDate = Carbon::now();
$start = Carbon::now();
$end = Carbon::now();
$terms = explode('-', $fiscalYear);
if ($terms[0] <= $start->month) {
$startDate->month($terms[0])->startOfMonth();
$start->month($terms[0])->startOfMonth();
$end->month($terms[0])->endOfMonth();
} else {
$startDate->subYear()->month($terms[0])->startOfMonth();
$start->subYear()->month($terms[0])->startOfMonth();
$end->subYear()->month($terms[0])->endOfMonth();
}
if ($request->has('previous_year')) {
$startDate->subYear()->startOfMonth();
$start->subYear()->startOfMonth();
$end->subYear()->endOfMonth();
}
while ($monthCounter < 12) {
array_push(
$invoiceTotals,
Invoice::whereBetween(
'invoice_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->whereCustomer($customer->id)
->sum('total') ?? 0
);
array_push(
$expenseTotals,
Expense::whereBetween(
'expense_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->whereUser($customer->id)
->sum('amount') ?? 0
);
array_push(
$receiptTotals,
Payment::whereBetween(
'payment_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->whereCustomer($customer->id)
->sum('amount') ?? 0
);
array_push(
$netProfits,
($receiptTotals[$i] - $expenseTotals[$i])
);
$i++;
array_push($months, $start->format('M'));
$monthCounter++;
$end->startOfMonth();
$start->addMonth()->startOfMonth();
$end->addMonth()->endOfMonth();
}
$start->subMonth()->endOfMonth();
$salesTotal = Invoice::whereBetween(
'invoice_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->whereCustomer($customer->id)
->sum('total');
$totalReceipts = Payment::whereBetween(
'payment_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->whereCustomer($customer->id)
->sum('amount');
$totalExpenses = Expense::whereBetween(
'expense_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->whereUser($customer->id)
->sum('amount');
$netProfit = (int) $totalReceipts - (int) $totalExpenses;
$chartData = [
'months' => $months,
'invoiceTotals' => $invoiceTotals,
'expenseTotals' => $expenseTotals,
'receiptTotals' => $receiptTotals,
'netProfit' => $netProfit,
'netProfits' => $netProfits,
'salesTotal' => $salesTotal,
'totalReceipts' => $totalReceipts,
'totalExpenses' => $totalExpenses,
];
$customer = Customer::find($customer->id);
return (new CustomerResource($customer))
->additional(['meta' => [
'chartData' => $chartData
]]);
}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Customer;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests;
use Crater\Http\Requests\DeleteCustomersRequest;
use Crater\Http\Resources\CustomerResource;
use Crater\Models\Customer;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class CustomersController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\JsonResponse
*/
public function index(Request $request)
{
$this->authorize('viewAny', Customer::class);
$limit = $request->has('limit') ? $request->limit : 10;
$customers = Customer::with('creator')
->whereCompany()
->applyFilters($request->all())
->select(
'customers.*',
DB::raw('sum(invoices.base_due_amount) as base_due_amount'),
DB::raw('sum(invoices.due_amount) as due_amount'),
)
->groupBy('customers.id')
->leftJoin('invoices', 'customers.id', '=', 'invoices.customer_id')
->paginateData($limit);
return (CustomerResource::collection($customers))
->additional(['meta' => [
'customer_total_count' => Customer::whereCompany()->count(),
]]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function store(Requests\CustomerRequest $request)
{
$this->authorize('create', Customer::class);
$customer = Customer::createCustomer($request);
return new CustomerResource($customer);
}
/**
* Display the specified resource.
*
* @param Customer $customer
* @return \Illuminate\Http\JsonResponse
*/
public function show(Customer $customer)
{
$this->authorize('view', $customer);
return new CustomerResource($customer);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Models\Customer $customer
* @return \Illuminate\Http\JsonResponse
*/
public function update(Requests\CustomerRequest $request, Customer $customer)
{
$this->authorize('update', $customer);
$customer = Customer::updateCustomer($request, $customer);
if (is_string($customer)) {
return respondJson('you_cannot_edit_currency', 'Cannot change currency once transactions created');
}
return new CustomerResource($customer);
}
/**
* Remove a list of Customers along side all their resources (ie. Estimates, Invoices, Payments and Addresses)
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function delete(DeleteCustomersRequest $request)
{
$this->authorize('delete multiple customers');
Customer::deleteCustomers($request->ids);
return response()->json([
'success' => true,
]);
}
}

View File

@@ -0,0 +1,166 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Dashboard;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Models\Company;
use Crater\Models\CompanySetting;
use Crater\Models\Customer;
use Crater\Models\Estimate;
use Crater\Models\Expense;
use Crater\Models\Invoice;
use Crater\Models\Payment;
use Illuminate\Http\Request;
use Silber\Bouncer\BouncerFacade;
class DashboardController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(Request $request)
{
$company = Company::find($request->header('company'));
$this->authorize('view dashboard', $company);
$invoice_totals = [];
$expense_totals = [];
$receipt_totals = [];
$net_income_totals = [];
$i = 0;
$months = [];
$monthCounter = 0;
$fiscalYear = CompanySetting::getSetting('fiscal_year', $request->header('company'));
$startDate = Carbon::now();
$start = Carbon::now();
$end = Carbon::now();
$terms = explode('-', $fiscalYear);
if ($terms[0] <= $start->month) {
$startDate->month($terms[0])->startOfMonth();
$start->month($terms[0])->startOfMonth();
$end->month($terms[0])->endOfMonth();
} else {
$startDate->subYear()->month($terms[0])->startOfMonth();
$start->subYear()->month($terms[0])->startOfMonth();
$end->subYear()->month($terms[0])->endOfMonth();
}
if ($request->has('previous_year')) {
$startDate->subYear()->startOfMonth();
$start->subYear()->startOfMonth();
$end->subYear()->endOfMonth();
}
while ($monthCounter < 12) {
array_push(
$invoice_totals,
Invoice::whereBetween(
'invoice_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_total')
);
array_push(
$expense_totals,
Expense::whereBetween(
'expense_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount')
);
array_push(
$receipt_totals,
Payment::whereBetween(
'payment_date',
[$start->format('Y-m-d'), $end->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount')
);
array_push(
$net_income_totals,
($receipt_totals[$i] - $expense_totals[$i])
);
$i++;
array_push($months, $start->format('M'));
$monthCounter++;
$end->startOfMonth();
$start->addMonth()->startOfMonth();
$end->addMonth()->endOfMonth();
}
$start->subMonth()->endOfMonth();
$total_sales = Invoice::whereBetween(
'invoice_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->sum('base_total');
$total_receipts = Payment::whereBetween(
'payment_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount');
$total_expenses = Expense::whereBetween(
'expense_date',
[$startDate->format('Y-m-d'), $start->format('Y-m-d')]
)
->whereCompany()
->sum('base_amount');
$total_net_income = (int)$total_receipts - (int)$total_expenses;
$chart_data = [
'months' => $months,
'invoice_totals' => $invoice_totals,
'expense_totals' => $expense_totals,
'receipt_totals' => $receipt_totals,
'net_income_totals' => $net_income_totals,
];
$total_customer_count = Customer::whereCompany()->count();
$total_invoice_count = Invoice::whereCompany()
->count();
$total_estimate_count = Estimate::whereCompany()->count();
$total_amount_due = Invoice::whereCompany()
->sum('base_due_amount');
$recent_due_invoices = Invoice::with('customer')
->whereCompany()
->where('base_due_amount', '>', 0)
->take(5)
->latest()
->get();
$recent_estimates = Estimate::with('customer')->whereCompany()->take(5)->latest()->get();
return response()->json([
'total_amount_due' => $total_amount_due,
'total_customer_count' => $total_customer_count,
'total_invoice_count' => $total_invoice_count,
'total_estimate_count' => $total_estimate_count,
'recent_due_invoices' => BouncerFacade::can('view-invoice', Invoice::class) ? $recent_due_invoices : [],
'recent_estimates' => BouncerFacade::can('view-estimate', Estimate::class) ? $recent_estimates : [],
'chart_data' => $chart_data,
'total_sales' => $total_sales,
'total_receipts' => $total_receipts,
'total_expenses' => $total_expenses,
'total_net_income' => $total_net_income,
]);
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
class ChangeEstimateStatusController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param Estimate $estimate
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Estimate $estimate)
{
$this->authorize('send estimate', $estimate);
$estimate->update($request->only('status'));
return response()->json([
'success' => true,
]);
}
}

View File

@@ -0,0 +1,134 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Carbon\Carbon;
use Crater\Http\Controllers\Controller;
use Crater\Http\Resources\InvoiceResource;
use Crater\Models\CompanySetting;
use Crater\Models\Estimate;
use Crater\Models\Invoice;
use Crater\Services\SerialNumberFormatter;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Vinkla\Hashids\Facades\Hashids;
class ConvertEstimateController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Crater\Models\Estimate $estimate
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request, Estimate $estimate, Invoice $invoice)
{
$this->authorize('create', Invoice::class);
$estimate->load(['items', 'items.taxes', 'customer', 'taxes']);
$invoice_date = Carbon::now();
$due_date = null;
$dueDateEnabled = CompanySetting::getSetting(
'invoice_set_due_date_automatically',
$request->header('company')
);
if ($dueDateEnabled === 'YES') {
$dueDateDays = CompanySetting::getSetting(
'invoice_due_date_days',
$request->header('company')
);
$due_date = Carbon::now()->addDays($dueDateDays)->format('Y-m-d');
}
$serial = (new SerialNumberFormatter())
->setModel($invoice)
->setCompany($estimate->company_id)
->setCustomer($estimate->customer_id)
->setNextNumbers();
$templateName = $estimate->getInvoiceTemplateName();
$exchange_rate = $estimate->exchange_rate;
$invoice = Invoice::create([
'creator_id' => Auth::id(),
'invoice_date' => $invoice_date->format('Y-m-d'),
'due_date' => $due_date,
'invoice_number' => $serial->getNextNumber(),
'sequence_number' => $serial->nextSequenceNumber,
'customer_sequence_number' => $serial->nextCustomerSequenceNumber,
'reference_number' => $serial->getNextNumber(),
'customer_id' => $estimate->customer_id,
'company_id' => $request->header('company'),
'template_name' => $templateName,
'status' => Invoice::STATUS_DRAFT,
'paid_status' => Invoice::STATUS_UNPAID,
'sub_total' => $estimate->sub_total,
'discount' => $estimate->discount,
'discount_type' => $estimate->discount_type,
'discount_val' => $estimate->discount_val,
'total' => $estimate->total,
'due_amount' => $estimate->total,
'tax_per_item' => $estimate->tax_per_item,
'discount_per_item' => $estimate->discount_per_item,
'tax' => $estimate->tax,
'notes' => $estimate->notes,
'exchange_rate' => $exchange_rate,
'base_discount_val' => $estimate->discount_val * $exchange_rate,
'base_sub_total' => $estimate->sub_total * $exchange_rate,
'base_total' => $estimate->total * $exchange_rate,
'base_tax' => $estimate->tax * $exchange_rate,
'currency_id' => $estimate->currency_id,
'sales_tax_type' => $estimate->sales_tax_type,
'sales_tax_address_type' => $estimate->sales_tax_address_type,
]);
$invoice->unique_hash = Hashids::connection(Invoice::class)->encode($invoice->id);
$invoice->save();
$invoiceItems = $estimate->items->toArray();
foreach ($invoiceItems as $invoiceItem) {
$invoiceItem['company_id'] = $request->header('company');
$invoiceItem['name'] = $invoiceItem['name'];
$estimateItem['exchange_rate'] = $exchange_rate;
$estimateItem['base_price'] = $invoiceItem['price'] * $exchange_rate;
$estimateItem['base_discount_val'] = $invoiceItem['discount_val'] * $exchange_rate;
$estimateItem['base_tax'] = $invoiceItem['tax'] * $exchange_rate;
$estimateItem['base_total'] = $invoiceItem['total'] * $exchange_rate;
$item = $invoice->items()->create($invoiceItem);
if (array_key_exists('taxes', $invoiceItem) && $invoiceItem['taxes']) {
foreach ($invoiceItem['taxes'] as $tax) {
$tax['company_id'] = $request->header('company');
if ($tax['amount']) {
$item->taxes()->create($tax);
}
}
}
}
if ($estimate->taxes) {
foreach ($estimate->taxes->toArray() as $tax) {
$tax['company_id'] = $request->header('company');
$tax['exchange_rate'] = $exchange_rate;
$tax['base_amount'] = $tax['amount'] * $exchange_rate;
$tax['currency_id'] = $estimate->currency_id;
unset($tax['estimate_id']);
$invoice->taxes()->create($tax);
}
}
$estimate->checkForEstimateConvertAction();
$invoice = Invoice::find($invoice->id);
return new InvoiceResource($invoice);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
class EstimateTemplatesController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function __invoke(Request $request)
{
$this->authorize('viewAny', Estimate::class);
$estimateTemplates = Estimate::estimateTemplates();
return response()->json([
'estimateTemplates' => $estimateTemplates
]);
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\DeleteEstimatesRequest;
use Crater\Http\Requests\EstimatesRequest;
use Crater\Http\Resources\EstimateResource;
use Crater\Jobs\GenerateEstimatePdfJob;
use Crater\Models\Estimate;
use Illuminate\Http\Request;
class EstimatesController extends Controller
{
public function index(Request $request)
{
$this->authorize('viewAny', Estimate::class);
$limit = $request->has('limit') ? $request->limit : 10;
$estimates = Estimate::whereCompany()
->join('customers', 'customers.id', '=', 'estimates.customer_id')
->applyFilters($request->all())
->select('estimates.*', 'customers.name')
->latest()
->paginateData($limit);
return (EstimateResource::collection($estimates))
->additional(['meta' => [
'estimate_total_count' => Estimate::whereCompany()->count(),
]]);
}
public function store(EstimatesRequest $request)
{
$this->authorize('create', Estimate::class);
$estimate = Estimate::createEstimate($request);
if ($request->has('estimateSend')) {
$estimate->send($request->title, $request->body);
}
GenerateEstimatePdfJob::dispatch($estimate);
return new EstimateResource($estimate);
}
public function show(Request $request, Estimate $estimate)
{
$this->authorize('view', $estimate);
return new EstimateResource($estimate);
}
public function update(EstimatesRequest $request, Estimate $estimate)
{
$this->authorize('update', $estimate);
$estimate = $estimate->updateEstimate($request);
GenerateEstimatePdfJob::dispatch($estimate, true);
return new EstimateResource($estimate);
}
public function delete(DeleteEstimatesRequest $request)
{
$this->authorize('delete multiple estimates');
Estimate::destroy($request->ids);
return response()->json([
'success' => true,
]);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\SendEstimatesRequest;
use Crater\Models\Estimate;
class SendEstimateController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Crater\Http\Requests\SendEstimatesRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(SendEstimatesRequest $request, Estimate $estimate)
{
$this->authorize('send estimate', $estimate);
$response = $estimate->send($request->all());
return response()->json($response);
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Crater\Http\Controllers\V1\Admin\Estimate;
use Crater\Http\Controllers\Controller;
use Crater\Http\Requests\SendEstimatesRequest;
use Crater\Models\Estimate;
use Illuminate\Mail\Markdown;
class SendEstimatePreviewController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Crater\Http\Requests\SendEstimatesRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function __invoke(SendEstimatesRequest $request, Estimate $estimate)
{
$this->authorize('send estimate', $estimate);
$markdown = new Markdown(view(), config('mail.markdown'));
$data = $estimate->sendEstimateData($request->all());
$data['url'] = $estimate->estimatePdfUrl;
return $markdown->render('emails.send.estimate', ['data' => $data]);
}
}

Some files were not shown because too many files have changed in this diff Show More