Compare commits
8 Commits
AUT-1376-n
...
main
Author | SHA1 | Date | |
---|---|---|---|
8f9041301c | |||
3573fc8895 | |||
253d4ab6bd | |||
1c9d30b688 | |||
feff219994 | |||
6bc2fe0f46 | |||
![]() |
3d62fabaac | ||
![]() |
e41a331ad7 |
52
.gitea/workflows/registry.yml
Normal file
52
.gitea/workflows/registry.yml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
name: release-tag
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
jobs:
|
||||||
|
release-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DOCKER_ORG: groot
|
||||||
|
DOCKER_LATEST: latest
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker BuildX
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with: # replace it with your local IP
|
||||||
|
config-inline: |
|
||||||
|
[registry."git.send.nrw"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: git.send.nrw # replace it with your local IP
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Get Meta
|
||||||
|
id: meta
|
||||||
|
run: |
|
||||||
|
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
||||||
|
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: ./docker
|
||||||
|
file: ./docker/Dockerfile.compose
|
||||||
|
entrypoint: ./docker/compose-entrypoint.sh
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: | # replace it with your local IP and tags
|
||||||
|
git.send.nrw/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
|
||||||
|
git.send.nrw/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
|
@@ -1,10 +1,7 @@
|
|||||||
version: '3.9'
|
version: '3.9'
|
||||||
services:
|
services:
|
||||||
main:
|
main:
|
||||||
build:
|
image: git.send.nrw/groot/automatisch:latest
|
||||||
context: ./docker
|
|
||||||
dockerfile: Dockerfile.compose
|
|
||||||
entrypoint: /compose-entrypoint.sh
|
|
||||||
ports:
|
ports:
|
||||||
- '3000:3000'
|
- '3000:3000'
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -28,10 +25,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- automatisch_storage:/automatisch/storage
|
- automatisch_storage:/automatisch/storage
|
||||||
worker:
|
worker:
|
||||||
build:
|
image: git.send.nrw/groot/automatisch:latest
|
||||||
context: ./docker
|
|
||||||
dockerfile: Dockerfile.compose
|
|
||||||
entrypoint: /compose-entrypoint.sh
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- main
|
- main
|
||||||
environment:
|
environment:
|
||||||
|
@@ -1,27 +1,4 @@
|
|||||||
import process from 'process';
|
import { generateQueue } from './queue.js';
|
||||||
import { Queue } from 'bullmq';
|
|
||||||
import redisConfig from '../config/redis.js';
|
|
||||||
import logger from '../helpers/logger.js';
|
|
||||||
|
|
||||||
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
|
||||||
|
|
||||||
const redisConnection = {
|
|
||||||
connection: redisConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
const actionQueue = new Queue('action', redisConnection);
|
|
||||||
|
|
||||||
actionQueue.on('error', (error) => {
|
|
||||||
if (error.code === CONNECTION_REFUSED) {
|
|
||||||
logger.error(
|
|
||||||
'Make sure you have installed Redis and it is running.',
|
|
||||||
error
|
|
||||||
);
|
|
||||||
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error('Error happened in action queue!', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const actionQueue = generateQueue('action');
|
||||||
export default actionQueue;
|
export default actionQueue;
|
||||||
|
@@ -1,27 +1,4 @@
|
|||||||
import process from 'process';
|
import { generateQueue } from './queue.js';
|
||||||
import { Queue } from 'bullmq';
|
|
||||||
import redisConfig from '../config/redis.js';
|
|
||||||
import logger from '../helpers/logger.js';
|
|
||||||
|
|
||||||
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
|
||||||
|
|
||||||
const redisConnection = {
|
|
||||||
connection: redisConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
const deleteUserQueue = new Queue('delete-user', redisConnection);
|
|
||||||
|
|
||||||
deleteUserQueue.on('error', (error) => {
|
|
||||||
if (error.code === CONNECTION_REFUSED) {
|
|
||||||
logger.error(
|
|
||||||
'Make sure you have installed Redis and it is running.',
|
|
||||||
error
|
|
||||||
);
|
|
||||||
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error('Error happened in delete user queue!', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const deleteUserQueue = generateQueue('delete-user');
|
||||||
export default deleteUserQueue;
|
export default deleteUserQueue;
|
||||||
|
@@ -1,27 +1,4 @@
|
|||||||
import process from 'process';
|
import { generateQueue } from './queue.js';
|
||||||
import { Queue } from 'bullmq';
|
|
||||||
import redisConfig from '../config/redis.js';
|
|
||||||
import logger from '../helpers/logger.js';
|
|
||||||
|
|
||||||
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
|
||||||
|
|
||||||
const redisConnection = {
|
|
||||||
connection: redisConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
const emailQueue = new Queue('email', redisConnection);
|
|
||||||
|
|
||||||
emailQueue.on('error', (error) => {
|
|
||||||
if (error.code === CONNECTION_REFUSED) {
|
|
||||||
logger.error(
|
|
||||||
'Make sure you have installed Redis and it is running.',
|
|
||||||
error
|
|
||||||
);
|
|
||||||
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error('Error happened in email queue!', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const emailQueue = generateQueue('email');
|
||||||
export default emailQueue;
|
export default emailQueue;
|
||||||
|
@@ -1,27 +1,4 @@
|
|||||||
import process from 'process';
|
import { generateQueue } from './queue.js';
|
||||||
import { Queue } from 'bullmq';
|
|
||||||
import redisConfig from '../config/redis.js';
|
|
||||||
import logger from '../helpers/logger.js';
|
|
||||||
|
|
||||||
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
|
||||||
|
|
||||||
const redisConnection = {
|
|
||||||
connection: redisConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
const flowQueue = new Queue('flow', redisConnection);
|
|
||||||
|
|
||||||
flowQueue.on('error', (error) => {
|
|
||||||
if (error.code === CONNECTION_REFUSED) {
|
|
||||||
logger.error(
|
|
||||||
'Make sure you have installed Redis and it is running.',
|
|
||||||
error
|
|
||||||
);
|
|
||||||
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error('Error happened in flow queue!', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const flowQueue = generateQueue('flow');
|
||||||
export default flowQueue;
|
export default flowQueue;
|
||||||
|
44
packages/backend/src/queues/queue.js
Normal file
44
packages/backend/src/queues/queue.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import process from 'process';
|
||||||
|
import { Queue } from 'bullmq';
|
||||||
|
import redisConfig from '../config/redis.js';
|
||||||
|
import logger from '../helpers/logger.js';
|
||||||
|
|
||||||
|
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
||||||
|
|
||||||
|
const redisConnection = {
|
||||||
|
connection: redisConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const generateQueue = (queueName, options) => {
|
||||||
|
const queue = new Queue(queueName, redisConnection);
|
||||||
|
|
||||||
|
queue.on('error', (error) => queueOnError(error, queueName));
|
||||||
|
|
||||||
|
if (options?.runDaily) addScheduler(queueName, queue);
|
||||||
|
|
||||||
|
return queue;
|
||||||
|
};
|
||||||
|
|
||||||
|
const queueOnError = (error, queueName) => {
|
||||||
|
if (error.code === CONNECTION_REFUSED) {
|
||||||
|
const errorMessage =
|
||||||
|
'Make sure you have installed Redis and it is running.';
|
||||||
|
|
||||||
|
logger.error(errorMessage, error);
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.error(`Error happened in ${queueName} queue!`, error);
|
||||||
|
};
|
||||||
|
|
||||||
|
const addScheduler = (queueName, queue) => {
|
||||||
|
const everydayAtOneOclock = '0 1 * * *';
|
||||||
|
|
||||||
|
queue.add(queueName, null, {
|
||||||
|
jobId: queueName,
|
||||||
|
repeat: {
|
||||||
|
pattern: everydayAtOneOclock,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
@@ -1,40 +1,8 @@
|
|||||||
import process from 'process';
|
import { generateQueue } from './queue.js';
|
||||||
import { Queue } from 'bullmq';
|
|
||||||
import redisConfig from '../config/redis.js';
|
|
||||||
import logger from '../helpers/logger.js';
|
|
||||||
|
|
||||||
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
const removeCancelledSubscriptionsQueue = generateQueue(
|
||||||
|
|
||||||
const redisConnection = {
|
|
||||||
connection: redisConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
const removeCancelledSubscriptionsQueue = new Queue(
|
|
||||||
'remove-cancelled-subscriptions',
|
'remove-cancelled-subscriptions',
|
||||||
redisConnection
|
{ runDaily: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
removeCancelledSubscriptionsQueue.on('error', (error) => {
|
|
||||||
if (error.code === CONNECTION_REFUSED) {
|
|
||||||
logger.error(
|
|
||||||
'Make sure you have installed Redis and it is running.',
|
|
||||||
error
|
|
||||||
);
|
|
||||||
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error(
|
|
||||||
'Error happened in remove cancelled subscriptions queue!',
|
|
||||||
error
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
removeCancelledSubscriptionsQueue.add('remove-cancelled-subscriptions', null, {
|
|
||||||
jobId: 'remove-cancelled-subscriptions',
|
|
||||||
repeat: {
|
|
||||||
pattern: '0 1 * * *',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default removeCancelledSubscriptionsQueue;
|
export default removeCancelledSubscriptionsQueue;
|
||||||
|
@@ -1,27 +1,4 @@
|
|||||||
import process from 'process';
|
import { generateQueue } from './queue.js';
|
||||||
import { Queue } from 'bullmq';
|
|
||||||
import redisConfig from '../config/redis.js';
|
|
||||||
import logger from '../helpers/logger.js';
|
|
||||||
|
|
||||||
const CONNECTION_REFUSED = 'ECONNREFUSED';
|
|
||||||
|
|
||||||
const redisConnection = {
|
|
||||||
connection: redisConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
const triggerQueue = new Queue('trigger', redisConnection);
|
|
||||||
|
|
||||||
triggerQueue.on('error', (error) => {
|
|
||||||
if (error.code === CONNECTION_REFUSED) {
|
|
||||||
logger.error(
|
|
||||||
'Make sure you have installed Redis and it is running.',
|
|
||||||
error
|
|
||||||
);
|
|
||||||
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error('Error happened in trigger queue!', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const triggerQueue = generateQueue('trigger');
|
||||||
export default triggerQueue;
|
export default triggerQueue;
|
||||||
|
Reference in New Issue
Block a user