Skip to content

Commit

Permalink
Refresh template
Browse files Browse the repository at this point in the history
  • Loading branch information
rolljee committed Oct 5, 2023
1 parent 9f6bbac commit 6a03db3
Show file tree
Hide file tree
Showing 213 changed files with 21,486 additions and 1,009 deletions.
5 changes: 2 additions & 3 deletions .github/actions/functional-test-backend/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ runs:
- name: Run functional test backend
shell: bash
run: |
npm install
npx kourou app:start-services
npm run dev &
npm ci
docker compose up -d
bash ./.github/actions/functional-test-backend/wait-kuzzle.sh
npm run test:functional
2 changes: 1 addition & 1 deletion .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ runs:
- name: Install deps
shell: bash
run: |
npm install
npm ci
npm run test:lint
28 changes: 14 additions & 14 deletions .github/workflows/deploy_main.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ on:
- main

env:
NODE_VERSION: "16"
NODE_VERSION: "18"
KUZZLE_PAAS_REGISTRY: harbor.paas.kuzzle.io
KUZZLE_PAAS_PROJECT: <PROJECT_ID>

jobs:
push_backend:
name: Backend artefact
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.ACCESS_TOKEN }}
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Copy package-lock.json
run: cp ./package-lock.json ./apps/api
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
file: ./apps/api/Dockerfile
context: ./apps/api
Expand All @@ -53,18 +53,18 @@ jobs:

deploy_backend:
name: Deploy backend artefact
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: [push_backend]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get current commit short SHA
id: vars
shell: bash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=ref::$(echo $GITHUB_REF | cut -d / -f 3)"
- name: Install NodeJS
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Deploy to PaaS
Expand All @@ -76,14 +76,14 @@ jobs:
environment: ${{ steps.vars.outputs.ref }}
application: api
rollback: true
timeout: 180 # Higher timeout for the first deployment
timeout: 180
image: ${{ env.KUZZLE_PAAS_REGISTRY }}/${{ env.KUZZLE_PAAS_PROJECT }}/${{ steps.vars.outputs.ref }}/kuzzle:${{ steps.vars.outputs.sha_short }}

push_iot_console:
name: IoT Console artefact
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get current commit short SHA
id: vars
shell: bash
Expand All @@ -96,7 +96,7 @@ jobs:
registry: ${{ env.KUZZLE_PAAS_REGISTRY }}
username: ${{ secrets.KUZZLE_PAAS_USERNAME }}
password: ${{ secrets.KUZZLE_PAAS_PASSWORD }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Login PaaS
Expand All @@ -109,7 +109,7 @@ jobs:
- name: Copy package-lock.json
run: cp ./package-lock.json ./apps/web
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
build-args: |
VUE_APP_BACKEND=${{ steps.vars.outputs.ref }}
Expand All @@ -123,15 +123,15 @@ jobs:
runs-on: ubuntu-22.04
needs: [push_iot_console]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get current commit short SHA
id: vars
shell: bash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=ref::$(echo $GITHUB_REF | cut -d / -f 3)"
- name: Install NodeJS
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Deploy to PaaS
Expand All @@ -143,5 +143,5 @@ jobs:
environment: ${{ steps.vars.outputs.ref }}
application: iot
rollback: true
timeout: 90
timeout: 180
image: ${{ env.KUZZLE_PAAS_REGISTRY }}/${{ env.KUZZLE_PAAS_PROJECT }}/${{ steps.vars.outputs.ref }}/iot:${{ steps.vars.outputs.sha_short }}
43 changes: 14 additions & 29 deletions .github/workflows/development.workflow.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
name: Run functional tests and lint on development branches and pull requests

on:
push:
branches:
- 0-dev
- 1-dev
- 2-dev
- master
on:
pull_request: # All pull requests

env:
NODE_VERSION: "18"

jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true
ssh-key: ${{ secrets.SSH_KEY }}
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: ${{ env.NODE_VERSION }}

- name: Login to PaaS NPM registry
uses: kuzzleio/[email protected].0
uses: kuzzleio/[email protected].3
with:
username: ${{ secrets.CORE_TEAM_PAAS_USERNAME }}
password: ${{ secrets.CORE_TEAM_PAAS_PASSWORD }}
login_only: true
npmrc_output_dir: ./

- name: Copy NPMRC
run: cp .npmrc ~/.npmrc
npmrc_output_dir: ~/.npmrc

- uses: ./.github/actions/lint

Expand All @@ -44,25 +35,19 @@ jobs:
needs: [lint]
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true
ssh-key: ${{ secrets.SSH_KEY }}
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: ${{ env.NODE_VERSION }}

- name: Login to PaaS NPM registry
uses: kuzzleio/[email protected].0
uses: kuzzleio/[email protected].3
with:
username: ${{ secrets.CORE_TEAM_PAAS_USERNAME }}
password: ${{ secrets.CORE_TEAM_PAAS_PASSWORD }}
login_only: true
npmrc_output_dir: ./

- name: Copy NPMRC
run: cp .npmrc ~/.npmrc
npmrc_output_dir: ~/.npmrc

- uses: ./.github/actions/functional-test-backend
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ Log to Kuzzle npm private repository : https://docs.kuzzle.io/paas-console/1/gui

Go to the repository root and run `npm install`

### Run the dev server
### Run the stack

First you need to run Elasticsearch and Redis, at the repository root: `docker-compose up`

Go to the repository root and run `npm run dev`
```bash
docker compose up -d
```

## Useful Links

Expand Down
7 changes: 0 additions & 7 deletions apps/api/.eslintignore

This file was deleted.

15 changes: 15 additions & 0 deletions apps/api/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('node:path');

module.exports = {
root: true,
plugins: ['kuzzle'],
extends: ['plugin:kuzzle/default', 'plugin:kuzzle/node', 'plugin:kuzzle/typescript'],
parserOptions: {
project: path.join(__dirname, 'tsconfig.test.json'),
},
rules: {
'sort-keys': 'off',
},
ignorePatterns: ['dist/*'],
};
14 changes: 0 additions & 14 deletions apps/api/.eslintrc.json

This file was deleted.

13 changes: 0 additions & 13 deletions apps/api/.gitignore

This file was deleted.

6 changes: 6 additions & 0 deletions apps/api/.lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const rootConfig = require('../../.lintstagedrc.cjs');

module.exports = {
...rootConfig,
'*.ts': ['eslint', () => 'tsc --noEmit -p tsconfig.test.json'],
};
9 changes: 4 additions & 5 deletions apps/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Builder stage
FROM kuzzleio/kuzzle-runner:16 as builder
FROM kuzzleio/kuzzle-runner:18 AS builder

WORKDIR /var/app

Expand All @@ -10,15 +10,15 @@ RUN npm run build
RUN npm prune --production

# Final image
FROM node:16-bullseye-slim
FROM node:14-bullseye-slim

ARG KUZZLE_ENV="local"
ARG KUZZLE_VAULT_KEY=""

# Uncomment if you want to use the Kuzzle Vault
# See https://docs.kuzzle.io/core/2/guides/advanced/secrets-vault
# ENV KUZZLE_VAULT_KEY=$KUZZLE_VAULT_KEY
# ENV KUZZLE_SECRETS_FILE="/var/app/secrets.enc.json"
# ENV KUZZLE_SECRETS_FILE="/var/app/environments/${KUZZLE_ENV}/secrets.enc.json"

ENV NODE_ENV=production

Expand All @@ -27,8 +27,7 @@ COPY --from=builder /var/app/node_modules /var/app/node_modules
COPY --from=builder /var/app/package.json /var/app/package.json
COPY --from=builder /var/app/package-lock.json /var/app/package-lock.json
COPY --from=builder /var/app/environments/${KUZZLE_ENV}/kuzzlerc /var/app/.kuzzlerc
COPY --from=builder /var/app/environments/${KUZZLE_ENV}/secrets.enc.json /var/app/secrets.enc.json

WORKDIR /var/app

CMD [ "node", "app.js" ]
CMD [ "node", "app.js" ]
Loading

0 comments on commit 6a03db3

Please sign in to comment.