-
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: workflows app * ci: apply automated fixes * chore: add dofigen * chore: fly.toml * fix: docker * fix: number coerce * wip: * fix: import * ci: apply automated fixes * chore: small stuff * chore: create scripts folder for tb * chore: cd * chore: build * chore: update key replace --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
33091d2
commit 8f9b44d
Showing
37 changed files
with
1,471 additions
and
584 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,24 @@ | ||
name: Fly Deploy Workflows | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "apps/workflows/**" | ||
- "packages/db/**" | ||
- "packages/emails/**" | ||
- "packages/utils/**" | ||
- "packages/tsconfig/**" | ||
jobs: | ||
deploy-workflows: | ||
name: Deploy Workflows | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- working-directory: apps/workflows | ||
name: Deploy Workflows | ||
run: | | ||
flyctl deploy --remote-only --wait-timeout=500 | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
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 |
---|---|---|
|
@@ -47,8 +47,8 @@ export function registerPostStatusReportUpdate( | |
) { | ||
return api.openapi(createStatusUpdate, async (c) => { | ||
const workspaceId = c.get("workspaceId"); | ||
const workspacePlan = c.get("workspacePlan"); | ||
const input = c.req.valid("json"); | ||
const limits = c.get("limits"); | ||
|
||
const _statusReport = await db | ||
.select() | ||
|
@@ -80,7 +80,7 @@ export function registerPostStatusReportUpdate( | |
|
||
// send email | ||
|
||
if (workspacePlan.limits.notifications && _statusReport.pageId) { | ||
if (limits["status-subscribers"] && _statusReport.pageId) { | ||
const subscribers = await db | ||
.select() | ||
.from(pageSubscriber) | ||
|
@@ -98,18 +98,15 @@ export function registerPostStatusReportUpdate( | |
.where(eq(page.id, _statusReport.pageId)) | ||
.get(); | ||
if (pageInfo) { | ||
const subscribersEmails = subscribers.map( | ||
(subscriber) => subscriber.email, | ||
); | ||
|
||
// TODO: verify if we leak any email data here | ||
await sendEmailHtml({ | ||
to: subscribersEmails, | ||
const subscribersEmails = subscribers.map((subscriber) => ({ | ||
to: subscriber.email, | ||
subject: `New status update for ${pageInfo.title}`, | ||
html: `<p>Hi,</p><p>${pageInfo.title} just posted an update on their status page:</p><p>New Status : ${statusReportUpdate.status}</p><p>${statusReportUpdate.message}</p></p><p></p><p>Powered by OpenStatus</p><p></p><p></p><p></p><p></p><p></p> | ||
`, | ||
`, | ||
from: "Notification OpenStatus <[email protected]>", | ||
}); | ||
})); | ||
|
||
await sendEmailHtml(subscribersEmails); | ||
} | ||
} | ||
|
||
|
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
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
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,15 @@ | ||
# This file is generated by Dofigen v2.1.0 | ||
# See https://github.com/lenra-io/dofigen | ||
|
||
node_modules | ||
/apps/docs | ||
/apps/screenshot-service | ||
/apps/server | ||
/apps/web | ||
/packages/analytics | ||
/packages/api | ||
/packages/error | ||
/packages/notifications | ||
/packages/tinybird | ||
/packages/tracker | ||
/packages/upstash |
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 @@ | ||
# deps | ||
node_modules/ |
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,42 @@ | ||
# syntax=docker/dockerfile:1.7 | ||
# This file is generated by Dofigen v2.1.0 | ||
# See https://github.com/lenra-io/dofigen | ||
|
||
# install | ||
FROM oven/bun@sha256:e2c0b11e277f0285e089ffb77ad831faeec2833b9c4b04d6d317f054e587ef4e AS install | ||
WORKDIR /app/ | ||
RUN \ | ||
--mount=type=bind,target=package.json,source=package.json \ | ||
--mount=type=bind,target=apps/workflows/package.json,source=apps/workflows/package.json \ | ||
--mount=type=bind,target=packages/assertions/package.json,source=packages/assertions/package.json \ | ||
--mount=type=bind,target=packages/db/package.json,source=packages/db/package.json \ | ||
--mount=type=bind,target=packages/emails/package.json,source=packages/emails/package.json \ | ||
--mount=type=bind,target=packages/utils/package.json,source=packages/utils/package.json \ | ||
--mount=type=bind,target=packages/tsconfig/package.json,source=packages/tsconfig/package.json \ | ||
--mount=type=cache,target=/root/.bun/install/cache,sharing=locked \ | ||
bun install --production --ignore-scripts --frozen-lockfile --verbose | ||
|
||
# build | ||
FROM oven/bun@sha256:e2c0b11e277f0285e089ffb77ad831faeec2833b9c4b04d6d317f054e587ef4e AS build | ||
ENV NODE_ENV="production" | ||
WORKDIR /app/apps/workflows | ||
COPY \ | ||
--link \ | ||
"." "/app/" | ||
COPY \ | ||
--from=install \ | ||
--link \ | ||
"/app/node_modules" "/app/node_modules" | ||
RUN bun build --compile --sourcemap src/index.ts --outfile=app | ||
|
||
# runtime | ||
FROM debian@sha256:610b4c7ad241e66f6e2f9791e3abdf0cc107a69238ab21bf9b4695d51fd6366a AS runtime | ||
COPY \ | ||
--from=build \ | ||
--chown=1000:1000 \ | ||
--chmod=555 \ | ||
--link \ | ||
"/app/apps/workflows/app" "/bin/" | ||
USER 1000:1000 | ||
EXPOSE 3000 | ||
ENTRYPOINT ["/bin/app"] |
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,33 @@ | ||
## Development | ||
|
||
To install dependencies: | ||
```sh | ||
bun install | ||
``` | ||
|
||
To run: | ||
```sh | ||
bun run dev | ||
``` | ||
|
||
open http://localhost:3000 | ||
|
||
|
||
## Deploy | ||
|
||
From root | ||
|
||
```bash | ||
flyctl deploy --config apps/workflows/fly.toml --dockerfile apps/workflows/Dockerfile | ||
``` | ||
|
||
## Docker | ||
|
||
The Dockerfile is generated thanks to [Dofigen](https://github.com/lenra-io/dofigen). To generate the Dockerfile, run the following command from the `apps/workflows` directory: | ||
|
||
```bash | ||
# Update the dependent image versions | ||
dofigen update | ||
# Generate the Dockerfile | ||
dofigen gen | ||
``` |
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,134 @@ | ||
effective: | | ||
ignore: | ||
- node_modules | ||
- /apps/docs | ||
- /apps/screenshot-service | ||
- /apps/server | ||
- /apps/web | ||
- /packages/analytics | ||
- /packages/api | ||
- /packages/error | ||
- /packages/notifications | ||
- /packages/tinybird | ||
- /packages/tracker | ||
- /packages/upstash | ||
builders: | ||
install: | ||
fromImage: | ||
path: oven/bun | ||
digest: sha256:e2c0b11e277f0285e089ffb77ad831faeec2833b9c4b04d6d317f054e587ef4e | ||
workdir: /app/ | ||
run: | ||
- bun install --production --ignore-scripts --frozen-lockfile --verbose | ||
cache: | ||
- target: /root/.bun/install/cache | ||
bind: | ||
- target: package.json | ||
source: package.json | ||
- target: apps/workflows/package.json | ||
source: apps/workflows/package.json | ||
- target: packages/assertions/package.json | ||
source: packages/assertions/package.json | ||
- target: packages/db/package.json | ||
source: packages/db/package.json | ||
- target: packages/emails/package.json | ||
source: packages/emails/package.json | ||
- target: packages/utils/package.json | ||
source: packages/utils/package.json | ||
- target: packages/tsconfig/package.json | ||
source: packages/tsconfig/package.json | ||
build: | ||
fromImage: | ||
path: oven/bun | ||
digest: sha256:e2c0b11e277f0285e089ffb77ad831faeec2833b9c4b04d6d317f054e587ef4e | ||
workdir: /app/apps/workflows | ||
env: | ||
NODE_ENV: production | ||
copy: | ||
- paths: | ||
- . | ||
target: /app/ | ||
- fromBuilder: install | ||
paths: | ||
- /app/node_modules | ||
target: /app/node_modules | ||
run: | ||
- bun build --compile --sourcemap src/index.ts --outfile=app | ||
fromImage: | ||
path: debian | ||
digest: sha256:610b4c7ad241e66f6e2f9791e3abdf0cc107a69238ab21bf9b4695d51fd6366a | ||
copy: | ||
- fromBuilder: build | ||
paths: | ||
- /app/apps/workflows/app | ||
target: /bin/ | ||
chmod: '555' | ||
entrypoint: | ||
- /bin/app | ||
expose: | ||
- port: 3000 | ||
images: | ||
registry.hub.docker.com:443: | ||
library: | ||
debian: | ||
bullseye-slim: | ||
digest: sha256:610b4c7ad241e66f6e2f9791e3abdf0cc107a69238ab21bf9b4695d51fd6366a | ||
oven: | ||
bun: | ||
latest: | ||
digest: sha256:e2c0b11e277f0285e089ffb77ad831faeec2833b9c4b04d6d317f054e587ef4e | ||
resources: | ||
dofigen.yml: | ||
hash: d232b15ff842b392611e64b97bf65d642ca573052072490c2f54ea2f4dc4481e | ||
content: | | ||
ignore: | ||
- node_modules | ||
- /apps/docs | ||
- /apps/screenshot-service | ||
- /apps/server | ||
- /apps/web | ||
- /packages/analytics | ||
- /packages/api | ||
- /packages/error | ||
- /packages/notifications | ||
- /packages/tinybird | ||
- /packages/tracker | ||
- /packages/upstash | ||
builders: | ||
install: | ||
fromImage: oven/bun | ||
workdir: /app/ | ||
# Copy project | ||
bind: | ||
- package.json | ||
- apps/workflows/package.json | ||
- packages/assertions/package.json | ||
- packages/db/package.json | ||
- packages/emails/package.json | ||
- packages/utils/package.json | ||
- packages/tsconfig/package.json | ||
# Install dependencies | ||
run: bun install --production --ignore-scripts --frozen-lockfile --verbose | ||
cache: | ||
- /root/.bun/install/cache | ||
build: | ||
fromImage: oven/bun | ||
workdir: /app/apps/workflows | ||
copy: | ||
- . /app/ | ||
- fromBuilder: install | ||
source: /app/node_modules | ||
target: /app/node_modules | ||
# Should set env to production here | ||
# Compile the TypeScript application | ||
env: | ||
NODE_ENV: production | ||
run: bun build --compile --sourcemap src/index.ts --outfile=app | ||
fromImage: debian:bullseye-slim | ||
copy: | ||
- fromBuilder: build | ||
source: /app/apps/workflows/app | ||
target: /bin/ | ||
chmod: "555" | ||
expose: 3000 | ||
entrypoint: /bin/app |
Oops, something went wrong.