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
import { Module } from '@nestjs/common'; | |
import { BullModule, BullRootModuleOptions } from '@nestjs/bull'; | |
import { QueuesService } from './queues.service'; | |
import { ConfigModule, ConfigService } from '@nestjs/config'; | |
import { AppConfig } from '../config/schema'; | |
@Module({ | |
imports: [ | |
BullModule.forRootAsync({ | |
imports: [ConfigModule], |
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
################################## | |
# Development stage | |
# This is not used at the moment, since the node_modules synchronization with host is complicated. | |
# Left here for future reference if we decide to run the app in docker during development. | |
################################## | |
FROM base as development | |
# Prepare the app directory and node user |
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
FROM node:18-alpine as build | |
WORKDIR /app | |
RUN yarn global add @vercel/ncc | |
COPY package.json yarn.lock ./ | |
RUN yarn install | |
COPY . . | |
RUN ./node_modules/.bin/prisma generate && yarn run build && ncc build dist/src/main.js -o build |
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
################################## | |
# Dev dependencies stage, only prepares node_modules, that are later reused | |
################################## | |
FROM node:14-slim as devdependencies | |
USER node | |
WORKDIR /app | |
COPY --chown=node:node package.json yarn.lock ./ | |
# Use docker mount cache, with locked sharing to avoid concurrency issues. |
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 is a simple starter for a String Calculator kata (https://osherove.com/tdd-kata-1/) | |
# The following link could be useful for working with the input string: | |
# https://developers.google.com/edu/python/strings | |
def add(numbers): | |
# Here, write the actual implementation. | |
# Don't forget to commit your changes, at least every time you solve a step. | |
# Also, don't be afraid to modify any of the existing code. Refactoring is your friend - as the complexity of | |
# the program grows, the readability of the code is crucial for future maintainability. |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"ec2:DescribeRegions", | |
"cloudwatch:GetMetricData", |
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
const express = require('express') | |
const app = express() | |
const port = 4000 | |
app.get('/', (req, res) => res.send('Hello World!')) | |
app.listen(port, () => console.log(`Example app listening on port ${port}!`)) | |
// node express.js |
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
export async function asyncForEach<T>(array: T[], callback: (item: T, index: number, allItems: T[]) => void) { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array); | |
} | |
} |
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
FROM node:9.8.0-alpine as build | |
WORKDIR /usr/src/app | |
COPY package.json yarn.lock ./ | |
RUN yarn | |
COPY . ./ | |
RUN yarn build | |
FROM nginx:1.13.9-alpine | |
COPY ./nginx.conf /etc/nginx/nginx.conf | |
COPY --from=build /usr/src/app/build /usr/share/nginx/html |
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
import logging | |
from celery.app.defaults import DEFAULT_TASK_LOG_FMT, DEFAULT_PROCESS_LOG_FMT | |
class CeleryTaskFilter(logging.Filter): | |
def filter(self, record): | |
return record.processName.find('Worker') != -1 |
NewerOlder