Skip to content

Commit

Permalink
Use Task and Bun workspaces instead of nx
Browse files Browse the repository at this point in the history
  • Loading branch information
unkhz committed Aug 4, 2024
1 parent e4e7d3a commit 1adce89
Show file tree
Hide file tree
Showing 37 changed files with 87 additions and 17,069 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ jobs:
- gatherer-stdin
- listener
- publisher
node-version: [20]

steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
with:
version: 2.x
version: 3.38.0
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.20
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Thumbs.db
# Bun
node_modules.bun

# Nx
# Tasks
.env.local

*-secret.yaml
Expand Down
16 changes: 3 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:lts-alpine AS buildtime
WORKDIR /app
COPY package*.json nx.json /app/
COPY package.json bun.lockb /app/

# Add any node packages
COPY packages/archive/*.json /app/packages/archive/
Expand All @@ -10,8 +10,8 @@ COPY packages/common-archive-client/*.json /app/packages/common-archive-client/
COPY packages/common-data/*.json /app/packages/common-data/
COPY packages/common-postgres/*.json /app/packages/common-postgres/

# Install dev deps for buildtime
RUN npm ci
# Remove dev deps for runtime
RUN bun install --frozen-lockfile --production

# Copy source code
COPY packages/archive /app/packages/archive/
Expand All @@ -21,14 +21,4 @@ COPY packages/common-archive-client /app/packages/common-archive-client/
COPY packages/common-data /app/packages/common-data/
COPY packages/common-postgres /app/packages/common-postgres/

# Build any node packages
RUN npx nx run-many --target=node:build --all

# Clean slate for runtime
FROM node:lts-alpine AS runtime
WORKDIR /app
COPY --link --from=buildtime /app/package*.json /app/nx.json /app/
COPY --link --from=buildtime /app/packages /app/packages

# Remove dev deps for runtime
RUN npm ci --omit=dev
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Following shiny tools are used

- [Redis Streams](https://redis.io/docs/data-types/streams/) for durable processing of measurements
- [TimescaleDb](https://www.timescale.com/) for SQL based long term storage of time series data
- [Nx (package based)](https://nx.dev) for monorepo organization and task running
- [Task](https://taskfile.dev/) for task running
- [Bun workspaces](https://bun.sh/docs/install/workspaces) for monorepo organization
- [Bun](https://bun.sh) TypeScript runtime for faster microservices (where necessary APIs are supported)
- [tRPC](https://trpc.io/) type-safe API for exposing database to serverless functions and apps
- [ruuvitag-listener](https://github.com/lautis/ruuvitag-listener) fast readings from Ruuvitag devices, written in Rust
Expand All @@ -28,27 +29,28 @@ Following shiny tools are used
Ensure you have installed following tools in your gateway box (e.g. raspberry pi).

- [Rust](https://rustup.rs/)
- [Node](https://nodejs.org/en/download/)
- [Bun](https://bun.sh/)
- [Redis](https://redis.io/docs/getting-started/installation/install-redis-on-linux/)

Install monorepo dependencies

```
npm install
bun install
```

Run package specific setup scripts

```
npm run setup
task common-data:setup
task infra-redis:setup
```

### Running

Run gateway functionality in gateway box

```
npm run start-gateway
task start-gateway
```

## Architecture
Expand Down
Binary file added bun.lockb
Binary file not shown.
31 changes: 0 additions & 31 deletions nx.json

This file was deleted.

Loading

0 comments on commit 1adce89

Please sign in to comment.