Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@ jobs:
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn build:image

- name: Start container
run: yarn start:platform
- name: Start containers
run: yarn start:platform && yarn start:platform-no-website

- name: Lint
run: yarn lint

- name: Test
run: yarn test

- name: Stop container
- name: Stop containers
if: always()
run: yarn stop:platform
run: yarn stop:platform && yarn stop:platform-no-website

- name: Stop mock services
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
cache-from: |
type=registry,ref=ghcr.io/lironer/bundlemon-${{ steps.app_name.outputs.value }}:latest
cache-to: type=inline
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
provenance: true
push: true

Expand Down
7 changes: 6 additions & 1 deletion apps/platform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ WORKDIR /app
RUN addgroup --system service && adduser --system -G service service

# Needed by @fastify/secure-session & for source maps
RUN npm i sodium-native@4.2.0 source-map-support@0.5.21
RUN set -ex; \
apk add --no-cache --virtual .gyp \
# Gyp build dependencies
python3 make g++; \
npm i sodium-native@4.2.0 source-map-support@0.5.21; \
apk del .gyp

COPY dist service

Expand Down
6 changes: 4 additions & 2 deletions apps/platform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bundlemon-platform",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"license": "MIT",
"scripts": {
Expand All @@ -10,7 +10,9 @@
"start:mock-services": "docker compose -f ../service/docker-compose.test.yml up --remove-orphans",
"stop:mock-services": "docker compose -f ../service/docker-compose.test.yml down",
"start:platform": "docker run --rm -d --name bundlemon-platform --env-file ../service/.development.env -e NODE_ENV=producation -e MONGO_DB_NAME=test -p 3333:3333 bundlemon-platform",
"stop:platform": "docker stop bundlemon-platform"
"stop:platform": "docker stop bundlemon-platform",
"start:platform-no-website": "docker run --rm -d --name bundlemon-platform-no-website --env-file ../service/.development.env -e NODE_ENV=producation -e MONGO_DB_NAME=test -e SHOULD_SERVE_WEBSITE=false -p 4444:3333 bundlemon-platform",
"stop:platform-no-website": "docker stop bundlemon-platform-no-website"
},
"dependencies": {},
"devDependencies": {}
Expand Down
2 changes: 1 addition & 1 deletion apps/platform/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
"prepare-image": {
"dependsOn": ["service:build", "website:build"],
"command": "rm -rf apps/platform/dist && cp -r apps/service/dist apps/platform/dist && cp -r dist/apps/website/* apps/platform/dist/public"
"command": "rm -rf {projectRoot}/dist && cp -r apps/service/dist {projectRoot}/dist && cp -r dist/apps/website/* {projectRoot}/dist/public"
},
"build-image": {
"dependsOn": ["prepare-image"],
Expand Down
1 change: 1 addition & 0 deletions apps/platform/tests/consts.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const BASE_URL = 'http://localhost:3333';
export const BASE_URL_NO_WEBSITE = 'http://localhost:4444';
16 changes: 12 additions & 4 deletions apps/platform/tests/isAlive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { BASE_URL } from './consts';
import { BASE_URL, BASE_URL_NO_WEBSITE } from './consts';

test('is alive', async () => {
const response = await fetch(`${BASE_URL}/is-alive`);
describe('is alive', () => {
test('platform', async () => {
const response = await fetch(`${BASE_URL}/is-alive`);

expect(response.status).toEqual(200);
expect(response.status).toEqual(200);
});

test('no website', async () => {
const response = await fetch(`${BASE_URL_NO_WEBSITE}/is-alive`);

expect(response.status).toEqual(200);
});
});
15 changes: 15 additions & 0 deletions apps/platform/tests/website.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { BASE_URL, BASE_URL_NO_WEBSITE } from './consts';

describe('serve website', () => {
test('platform', async () => {
const response = await fetch(BASE_URL);

expect(response.status).toEqual(200);
});

test('no website', async () => {
const response = await fetch(BASE_URL_NO_WEBSITE);

expect(response.status).toEqual(404);
});
});
12 changes: 6 additions & 6 deletions apps/service/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"format": ["cjs"],
"bundle": true,
"deleteOutputPath": true,
"main": "apps/service/src/app.ts",
"tsConfig": "apps/service/tsconfig.app.json",
"main": "{projectRoot}/src/app.ts",
"tsConfig": "{projectRoot}/tsconfig.app.json",
"generatePackageJson": false,
"external": ["sodium-native"],
"esbuildOptions": {
Expand All @@ -42,7 +42,7 @@
"assets": [
{
"glob": "**/*",
"input": "apps/service/public",
"input": "{projectRoot}/public",
"output": "public"
}
]
Expand All @@ -57,12 +57,12 @@
"assets": [
{
"glob": "**/*",
"input": "apps/service/public",
"input": "{projectRoot}/public",
"output": "public"
},
{
"glob": "**/*",
"input": "apps/service/src/local-certs",
"input": "{projectRoot}/src/local-certs",
"output": "local-certs"
}
]
Expand All @@ -73,7 +73,7 @@
},
"vercel": {
"outputPath": "{projectRoot}/api",
"main": "apps/service/vercel/serverless.ts",
"main": "{projectRoot}/vercel/serverless.ts",
"thirdParty": true,
"minify": true,
"assets": []
Expand Down