-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
129 changed files
with
42,162 additions
and
33,779 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ docker-compose.*.yml | |
*.sh | ||
*.json | ||
*.tar | ||
luacov.* | ||
|
||
!docker-compose.override.yml | ||
!install.sh | ||
!launch.sh |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
std = 'ngx_lua+busted' | ||
globals = {'bot', 'string'} | ||
globals = {'string'} | ||
max_string_line_length = false | ||
max_comment_line_length = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,42 @@ | ||
all: dev_polling logs | ||
|
||
clean: kill down | ||
# docker system prune -fa | ||
|
||
pot: | ||
find . -name "*.lua" | sort | xgettext --from-code=utf-8 \ | ||
--add-comments=TRANSLATORS \ | ||
--force-po \ | ||
--keyword=i18n \ | ||
--files-from=/dev/stdin \ | ||
--output=/dev/stdout | msgmerge --backup=off --update locales/en.po /dev/stdin | ||
--output=/dev/stdout | msgmerge --backup=off --update locales/en_GB.po /dev/stdin | ||
|
||
luacheck: | ||
luacheck . --exclude-files lua/vendor src | ||
|
||
logs: | ||
docker-compose logs -f --tail 20 | ||
|
||
kill: | ||
docker-compose kill groupbutler | ||
|
||
down: | ||
docker-compose -f docker-compose.yml -f docker/docker-compose.polling.yml down | ||
|
||
pull: | ||
docker-compose pull | ||
|
||
easy_deploy: pull | ||
docker-compose -f docker-compose.yml -f docker/docker-compose.polling.deploy.yml up -d | ||
|
||
build_polling: | ||
docker-compose -f docker-compose.yml -f docker/docker-compose.polling.yml build | ||
|
||
build_webhooks: | ||
docker-compose -f docker-compose.yml -f docker/docker-compose.webhooks.yml build | ||
|
||
dev_polling: kill build_polling | ||
docker-compose -f docker-compose.yml -f docker/docker-compose.polling.yml up | ||
|
||
dev_webhooks: kill build_webhooks | ||
docker-compose -f docker-compose.yml -f docker/docker-compose.webhooks.yml up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
env GB_OLD_UPDATE; | ||
env CHANNEL; | ||
env DEFAULT_LANG; | ||
env HELP_GROUP; | ||
env LOG_CHAT; | ||
env LOG_ADMIN; | ||
env LOG_STATS; | ||
env MULTIPURPOSE_PLUGINS; | ||
env POSTGRES_HOST; | ||
env POSTGRES_PORT; | ||
env POSTGRES_USER; | ||
env POSTGRES_PASSWORD; | ||
env POSTGRES_DB; | ||
env REDIS_HOST; | ||
env REDIS_PORT; | ||
env REDIS_DB; | ||
env SOURCE; | ||
env SUPERADMINS; | ||
env TG_TOKEN; | ||
env TG_UPDATES; | ||
env TG_POLLING_LIMIT; | ||
env TG_POLLING_TIMEOUT; | ||
env TG_WEBHOOK_URL; | ||
env TG_WEBHOOK_DOMAIN; | ||
env TG_WEBHOOK_CERT; | ||
env TG_WEBHOOK_MAX_CON; | ||
|
||
error_log /dev/stderr notice; | ||
|
||
master_process on; | ||
worker_processes auto; | ||
worker_cpu_affinity auto; | ||
|
||
events { | ||
worker_connections 10240; | ||
} | ||
|
||
http { | ||
client_body_buffer_size 1M; | ||
client_max_body_size 1M; | ||
log_format combined_no_query '$remote_addr ' '"$request_method $uri" $status $body_bytes_sent '; | ||
lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt; | ||
lua_ssl_verify_depth 2; | ||
lua_package_path "$prefix/lua/?.lua;$prefix/lua/vendor/?.lua;;"; | ||
lua_max_running_timers 10240; | ||
# lua_socket_log_errors off; | ||
# lua_code_cache off; # only during development | ||
resolver 127.0.0.11 ipv6=off; # use docker local resolver and disable IPv6 | ||
server { | ||
access_log /dev/stdout combined_no_query; | ||
listen 80; | ||
charset utf-8; | ||
charset_types application/json; | ||
default_type application/json; | ||
access_by_lua_block { | ||
local config = require "groupbutler.config" | ||
if not config.telegram.webhook.domain then -- Using custom URL. Don't check for the token | ||
return | ||
end | ||
if not ngx.var.arg_token or (ngx.var.arg_token ~= config.telegram.token) then | ||
ngx.exit(ngx.HTTP_FORBIDDEN) | ||
end | ||
return | ||
} | ||
location / { | ||
content_by_lua_block { | ||
require "groupbutler".go() | ||
} | ||
} | ||
location /set_webhook { | ||
content_by_lua_block { | ||
require "init_nginx".set_webhook() | ||
} | ||
} | ||
} | ||
server { | ||
listen 8000; | ||
access_log /dev/null; | ||
location /health { | ||
content_by_lua_block { | ||
require "groupbutler".health() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '3.6' | ||
|
||
services: | ||
groupbutler: | ||
environment: | ||
REDIS_HOST: redis | ||
restart: always | ||
|
||
redis: | ||
image: redis:alpine | ||
restart: always | ||
# Optional. Map redis port to the host if you want to explore the db | ||
# ports: | ||
# - "127.0.0.1:6379:6379" | ||
volumes: | ||
- redis:/data | ||
|
||
volumes: | ||
redis: |
17 changes: 10 additions & 7 deletions
17
docker-compose.override.yml → docker/docker-compose.polling.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
version: '3.3' | ||
version: '3.6' | ||
|
||
services: | ||
groupbutler: | ||
build: . | ||
depends_on: | ||
- redis | ||
build: | ||
context: . | ||
dockerfile: docker/polling.Dockerfile | ||
args: | ||
# DEPS_NATIVE: $DEPS_NATIVE | ||
# DEPS_ROCKS: $DEPS_ROCKS | ||
GB_COMMIT: $GB_COMMIT | ||
environment: | ||
- REDIS_HOST=redis | ||
restart: on-failure | ||
REDIS_HOST: redis | ||
volumes: | ||
- ./conf:/srv/app/conf | ||
- ./locales:/srv/app/locales | ||
- ./lua:/srv/app/lua | ||
- ./polling.lua:/srv/app/polling.lua | ||
|
||
redis: | ||
command: --save "" --appendonly no | ||
image: redis:alpine | ||
restart: on-failure | ||
ports: | ||
- "6379:6379" |
Oops, something went wrong.