-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Trying to launch a bot on a prod server using the socket mode
- Loading branch information
Showing
8 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.idea | ||
pg_data/ | ||
.github | ||
.devcontainer |
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 |
---|---|---|
|
@@ -160,3 +160,4 @@ cython_debug/ | |
.idea/ | ||
|
||
db/ | ||
pg_data/ |
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,74 @@ | ||
version: '3.8' | ||
|
||
services: | ||
merci-postgres: | ||
container_name: merci-postgres | ||
build: | ||
context: . | ||
dockerfile: docker/postgres/.Dockerfile | ||
environment: | ||
- POSTGRES_DB=thank_you | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- PGDATA=/var/lib/postgresql/data/pgdata | ||
volumes: | ||
- ./pg_data/pg-thank-you-data:/var/lib/postgresql/data/pgdata | ||
ports: | ||
- "5432:5432" | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U postgres -d postgres" ] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
start_period: 10s | ||
restart: always | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '1' | ||
memory: 1G | ||
networks: | ||
- wwf_network | ||
|
||
merci-bot: | ||
container_name: merci-bot | ||
depends_on: | ||
merci-postgres: | ||
condition: service_healthy | ||
restart: true | ||
environment: | ||
- POSTGRES_HOST=merci-postgres | ||
- SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN} | ||
- SLACK_APP_TOKEN=${SLACK_APP_TOKEN} | ||
- THANK_YOU_DAO=${THANK_YOU_DAO} | ||
build: | ||
context: . | ||
dockerfile: docker/bot/.Dockerfile | ||
restart: always | ||
networks: | ||
- wwf_network | ||
|
||
pgadmin: | ||
container_name: merci-pgadmin | ||
depends_on: | ||
- merci-postgres | ||
image: dpage/pgadmin4:7.2 | ||
environment: | ||
- PGADMIN_DEFAULT_EMAIL=test@gmail.com | ||
- PGADMIN_DEFAULT_PASSWORD=postgres | ||
- PGADMIN_CONFIG_SERVER_MODE=False | ||
ports: | ||
- "5433:80" | ||
networks: | ||
- wwf_network | ||
|
||
|
||
volumes: | ||
thank-you-data: | ||
name: thank-you-data | ||
|
||
|
||
networks: | ||
wwf_network: | ||
name: wwf_network | ||
driver: bridge |
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,6 @@ | ||
FROM python:3.8-alpine AS merci-bot | ||
RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev | ||
WORKDIR /merci-bot | ||
COPY . . | ||
RUN pip install -r requirements.txt | ||
CMD ["python", "-m", "thankyou.slackbot"] |
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,2 @@ | ||
FROM postgres:alpine | ||
COPY ./docker/postgres/docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/ |
10 changes: 10 additions & 0 deletions
10
docker/postgres/docker-entrypoint-initdb.d/init-user-db.sh
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,10 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL | ||
CREATE USER "thank-you-slack-bot" WITH PASSWORD 'thank-you-slack-bot'; | ||
GRANT ALL ON SCHEMA public TO "thank-you-slack-bot"; | ||
EOSQL | ||
|
||
# CREATE DATABASE thank_you; | ||
# GRANT ALL ON thank_you TO "thank-you-slack-bot"; |
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