Skip to content

Commit

Permalink
Upgrade dependencies (#1135)
Browse files Browse the repository at this point in the history
* Multi arch builds

* chore: fix npm deprecation warnings

Using corresponding new arguments, like the warnings recommended.

* chore: npm audit fix

Upgrade some deps to automatically fix their security issues.

* chore: remove unused watch

Could not find this depencency used of referenced anywhere.

* chore: remove unused @types/adm-zip

Could not find this depencency used of referenced anywhere.

* chore: minor upgrade typescript

Latest version 4 for now, because it requires the least changes to existing code and types.

* chore: minor upgrade tsnode

* chore: major upgrade tsnode

* chore: patch upgrade ts-essentials

* chore: minor upgrade sinon+chai

* chore: major upgrade sinon

* chore: major upgrade ts-essentials

* chore: minor upgrade pkg

* chore: minor upgrade nyc

* chore: patch upgrade husky

* chore: patch upgrade cucumber

* chore: patch upgrade coveralls

* chore: patch upgrade async

* chore: patch upgrade ws

* chore: minor upgrade uws

* chore: patch upgrade uuid

* chore: patch upgrade source-map-support

* chore: minor upgrade pino

* chore: major upgrade pino

* chore: major upgrade pino

* chore: minor upgrade needle

* chore: major upgrade needle

* chore: minor upgrade mqtt-connection

* chore: patch upgrade js-yaml

* chore: major upgrade js-yaml

* chore: minor upgrade http-status

* chore: minor upgrade glob

* chore: major upgrade glob

* chore: patch upgrade content-type

* chore: patch upgrade commander

* chore: major upgrade commander

* chore: patch upgrade chalk

* chore: minor upgrade body-parser

* chore: major upgrade better-ajv-errors

* fix: make unit tests work under node@20 too

* test: clarify

If my calculations are correct, "without without no" simplifies to "without".

* test: fatal log includes any metadata.error given

* chore: npm audit fix

---------

Co-authored-by: daanh432 <[email protected]>
  • Loading branch information
hugojosefson and daanh432 committed Oct 23, 2023
1 parent 50b2b91 commit 3e459ff
Show file tree
Hide file tree
Showing 29 changed files with 2,661 additions and 1,993 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/.git/
**/.github/
**/node_modules/

**/Dockerfile
**/Dockerfile.*

**/.env.*.local
**/.env.local
58 changes: 55 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,60 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
node-version: '18.x'
- run: DOCKER_PASSWORD=${{ secrets.DOCKERHUB_TOKEN }} DOCKER_USERNAME=${{ secrets.DOCKERHUB_USERNAME }} bash scripts/docker.sh
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: deepstreamio/deepstream.io
flavor: |
latest=true
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

docker-alpine:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: deepstreamio/deepstream.io
flavor: |
latest=true
suffix=-alpine,onlatest=true
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.alpine
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM node:10

FROM node:18 as builder
WORKDIR /app
# RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# RUN unzip awscliv2.zip
# RUN ./aws/install

COPY package*.json ./

RUN npm install --production \
RUN npm ci
RUN npm install --omit=dev \
@deepstream/cache-redis \
# @deepstream/cache-memcached \
# @deepstream/cache-hazelcast \
Expand All @@ -18,11 +19,17 @@ RUN npm install --production \
@deepstream/logger-winston \
@deepstream/plugin-aws

COPY . ./
COPY . .

RUN npm run tsc

FROM node:18
WORKDIR /usr/local/deepstream
COPY --from=builder /app/node_modules/ ./node_modules
COPY --from=builder /app/dist/ .

EXPOSE 6020
EXPOSE 8080
EXPOSE 9229

CMD ["node", "./bin/deepstream.js", "start", "--inspect=0.0.0.0:9229"]

37 changes: 37 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM node:18-alpine as builder
WORKDIR /app
# RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# RUN unzip awscliv2.zip
# RUN ./aws/install

COPY package*.json ./

RUN npm ci
RUN npm install --omit=dev \
@deepstream/cache-redis \
# @deepstream/cache-memcached \
# @deepstream/cache-hazelcast \
@deepstream/clusternode-redis \
@deepstream/storage-mongodb \
@deepstream/storage-rethinkdb \
@deepstream/storage-elasticsearch \
@deepstream/storage-postgres \
@deepstream/logger-winston \
@deepstream/plugin-aws

RUN npm uninstall --save uWebSockets.js

COPY . .

RUN npm run tsc

FROM node:18-alpine
WORKDIR /usr/local/deepstream
COPY --from=builder /app/node_modules/ ./node_modules
COPY --from=builder /app/dist/ .

EXPOSE 6020
EXPOSE 8080
EXPOSE 9229

CMD ["node", "./bin/deepstream.js", "start", "--inspect=0.0.0.0:9229"]
10 changes: 2 additions & 8 deletions bin/deepstream-cluster.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import * as commander from 'commander'
import { Command } from 'commander'
import * as cluster from 'cluster'
const numCPUs = require('os').cpus().length
import { EVENT } from '@deepstream/types'

// work-around for:
// TS4023: Exported variable 'command' has or is using name 'local.Command'
// from external module "node_modules/commander/typings/index" but cannot be named.
// tslint:disable-next-line: no-empty-interface
export interface Command extends commander.Command { }

export const verticalCluster = (program: Command) => {
program
.command('cluster')
Expand Down Expand Up @@ -80,4 +74,4 @@ function action () {
process.exit(1)
}
}
}
}
8 changes: 1 addition & 7 deletions bin/deepstream-daemon.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// @ts-ignore
import * as dsDaemon from '../src/service/daemon'
import * as commander from 'commander'

// work-around for:
// TS4023: Exported variable 'command' has or is using name 'local.Command'
// from external module "node_modules/commander/typings/index" but cannot be named.
// tslint:disable-next-line: no-empty-interface
export interface Command extends commander.Command { }
import { Command } from 'commander'

export const daemon = (program: Command) => {
program
Expand Down
8 changes: 1 addition & 7 deletions bin/deepstream-hash.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import * as jsYamlLoader from '../src/config/js-yaml-loader'
import * as commander from 'commander'
import { Command } from 'commander'
import { createHash } from '../src/utils/utils'

// work-around for:
// TS4023: Exported variable 'command' has or is using name 'local.Command'
// from external module "node_modules/commander/typings/index" but cannot be named.
// tslint:disable-next-line: no-empty-interface
export interface Command extends commander.Command { }

export const hash = (program: Command) => {
program
.command('hash [password]')
Expand Down
8 changes: 1 addition & 7 deletions bin/deepstream-info.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import * as jsYamlLoader from '../src/config/js-yaml-loader'
import * as commander from 'commander'
import { Command } from 'commander'
import { getDSInfo } from '../src/config/ds-info'

// work-around for:
// TS4023: Exported variable 'command' has or is using name 'local.Command'
// from external module "node_modules/commander/typings/index" but cannot be named.
// tslint:disable-next-line: no-empty-interface
export interface Command extends commander.Command { }

export const info = (program: Command) => {
program
.command('info')
Expand Down
8 changes: 1 addition & 7 deletions bin/deepstream-nginx.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
// @ts-ignore
import * as dsService from '../src/service/service'
import * as commander from 'commander'
import { Command } from 'commander'
import { writeFileSync } from 'fs'
import * as jsYamlLoader from '../src/config/js-yaml-loader'
import * as fileUtil from '../src/config/file-utils'

// work-around for:
// TS4023: Exported variable 'command' has or is using name 'local.Command'
// from external module "node_modules/commander/typings/index" but cannot be named.
// tslint:disable-next-line: no-empty-interface
export interface Command extends commander.Command { }

export const nginx = (program: Command) => {
program
.command('nginx')
Expand Down
8 changes: 1 addition & 7 deletions bin/deepstream-service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// @ts-ignore
import * as dsService from '../src/service/service'
import * as commander from 'commander'

// work-around for:
// TS4023: Exported variable 'command' has or is using name 'local.Command'
// from external module "node_modules/commander/typings/index" but cannot be named.
// tslint:disable-next-line: no-empty-interface
export interface Command extends commander.Command { }
import { Command } from 'commander'

export const service = (program: Command) => {
program
Expand Down
12 changes: 3 additions & 9 deletions bin/deepstream-start.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import * as commander from 'commander'
import { Command } from 'commander'
import { EVENT } from '@deepstream/types'

// work-around for:
// TS4023: Exported variable 'command' has or is using name 'local.Command'
// from external module "node_modules/commander/typings/index" but cannot be named.
// tslint:disable-next-line: no-empty-interface
export interface Command extends commander.Command { }

export const start = (program: Command) => {
program
.command('start')
.command('start', { isDefault: true })
.description('start a deepstream server')

.option('-c, --config [file]', 'configuration file, parent directory will be used as prefix for other config files')
Expand Down Expand Up @@ -51,7 +45,7 @@ function action () {
ds.stop()
})
} catch (err) {
console.error(err.toString())
console.error(err?.toString())
process.exit(1)
}
}
Expand Down
4 changes: 0 additions & 4 deletions bin/deepstream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ verticalCluster(program)
nginx(program)

program.parse(process.argv)

if (program.rawArgs.length <= 2) {
program.emit('command:start')
}

0 comments on commit 3e459ff

Please sign in to comment.