Commit f5400e7e authored by nic's avatar nic
Browse files

feat: docker run

1 merge request!1Mvp
Showing with 171 additions and 4 deletions
+171 -4
.env 0 → 100644
# N8N data
POSTGRES_USER=changeUser
POSTGRES_PASSWORD=changePassword
POSTGRES_DB=n8n
POSTGRES_NON_ROOT_USER=changeUser
POSTGRES_NON_ROOT_PASSWORD=changePassword
N8N_CUSTOM_EXTENSIONS=/home/node/.n8n/custom
# ChatGate data
POSTGRES_USER_CHAT=test
POSTGRES_PASSWORD_CHAT=test
POSTGRES_DB_CHAT=chatgate
Dockerfile 0 → 100644
ARG NODE_VERSION=18
FROM n8nio/base:${NODE_VERSION}
ARG N8N_VERSION
RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi
ENV N8N_VERSION=${N8N_VERSION}
ENV N8N_RELEASE_TYPE=stable
RUN set -eux; \
npm install typescript -g && \
npm install -g --omit=dev n8n@${N8N_VERSION} --ignore-scripts && \
npm rebuild --prefix=/usr/local/lib/node_modules/n8n sqlite3 && \
npm install gulp && \
npm install -g gulp-cli && \
npm install n8n-workflow && \
rm -rf /usr/local/lib/node_modules/n8n/node_modules/@n8n/chat && \
rm -rf /usr/local/lib/node_modules/n8n/node_modules/n8n-design-system && \
rm -rf /usr/local/lib/node_modules/n8n/node_modules/n8n-editor-ui/node_modules && \
find /usr/local/lib/node_modules/n8n -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" | xargs rm -f && \
rm -rf /root/.npm
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
RUN \
mkdir .n8n && \
chown node:node .n8n
RUN cd ./.n8n && \
mkdir custom && \
cd custom && \
git clone https://github.com/pvpender/n8n-nodes-zulip-real-time && \
npm --prefix ./n8n-nodes-zulip-real-time i && \
npm --prefix ./n8n-nodes-zulip-real-time run build && \
git clone https://github.com/bergi9/n8n-nodes-telegram-polling && \
npm --prefix ./n8n-nodes-telegram-polling i && \
npm --prefix ./n8n-nodes-telegram-polling run build
ENV SHELL /bin/sh
USER root
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
\ No newline at end of file
version: "3.9"
services:
postgres:
image: postgres:13.3
image: postgres:16
#restart: always
environment:
POSTGRES_DB: "test"
POSTGRES_USER: "user"
POSTGRES_PASSWORD: "password"
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_NON_ROOT_USER=${POSTGRES_NON_ROOT_USER}
- POSTGRES_NON_ROOT_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
expose:
- "5434"
ports:
- "5434:5432"
volumes:
- postgres_data:/var/lib/postgresql/data:rw
- ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
healthcheck:
test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
interval: 5s
timeout: 5s
retries: 10
postgresChatGate:
image: postgres:16
#restart: always
environment:
- POSTGRES_USER=${POSTGRES_USER_CHAT}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD_CHAT}
- POSTGRES_DB=${POSTGRES_DB_CHAT}
ports:
- "5432:5432"
volumes:
- chat_gate_data:/var/lib/postgresql/data:rw
- ./postgres:/docker-entrypoint-initdb.d
n8n:
build:
context: .
args:
- N8N_VERSION=1.34.1
#restart: always
environment:
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
- DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
- N8N_CUSTOM_EXTENSIONS=${N8N_CUSTOM_EXTENSIONS}
ports:
- 5678:5678
links:
- postgres
volumes:
- n8n_data:/home/node/.n8n
depends_on:
postgres:
condition: service_healthy
volumes:
postgres_data:
n8n_data:
chat_gate_data:
#!/bin/sh
if [ "$#" -gt 0 ]; then
# Got started with arguments
exec n8n "$@"
else
# Got started without arguments
exec n8n
fi
\ No newline at end of file
init-data.sh 0 → 100644
#!/bin/bash
set -e;
if [ -n "${POSTGRES_NON_ROOT_USER:-}" ] && [ -n "${POSTGRES_NON_ROOT_PASSWORD:-}" ]; then
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER ${POSTGRES_NON_ROOT_USER} WITH PASSWORD '${POSTGRES_NON_ROOT_PASSWORD}';
GRANT ALL PRIVILEGES ON DATABASE ${POSTGRES_DB} TO ${POSTGRES_NON_ROOT_USER};
GRANT CREATE ON SCHEMA public TO ${POSTGRES_NON_ROOT_USER};
EOSQL
else
echo "SETUP INFO: No Environment variables given!"
fi
\ No newline at end of file
CREATE TABLE users (
tg_id BIGINT PRIMARY KEY ,
zulip_id int,
email VARCHAR(64),
name VARCHAR(120)
);
CREATE TABLE states (
id BIGINT PRIMARY KEY ,
state int4 NOT NULL
);
CREATE TABLE IF NOT EXISTS last_message(
id int PRIMARY KEY,
last_id int
);
CREATE TABLE states_zulip(
id int PRIMARY KEY ,
state int4 NOT NULL
);
CREATE TABLE forwarding_zulip(
id int ,
channel_name VARCHAR(120),
channel_id int ,
topic_name VARCHAR(120)
);
CREATE TABLE forwarding_channels(
zulip_channel_id int,
zulip_topic_name VARCHAR(120),
telegram_chat_id bigint,
mode VARCHAR(8)
);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment