An open API service indexing awesome lists of open source software.

https://github.com/eswat2/proto-notes-dkr

a simple UI and API server packaged with Docker...
https://github.com/eswat2/proto-notes-dkr

docker vue websocket

Last synced: about 1 month ago
JSON representation

a simple UI and API server packaged with Docker...

Awesome Lists containing this project

README

          

# proto-notes-dkr

This project was orgininally setup as independent pieces. There were 2 parts:

- a UI written in Vue, deployed to Vercel
- an API server written in Node, deployed to Heroku

The original idea came from an Egghead course i took. That course built a UI in React with a backend in Firebase. I wrote my own server to replace Firebase, built with Node and Websockets, just to explore how this all worked. The server part was called **fire-notes** and that part is in the api folder of this repo. I later rewrote the UI while exploring Vue and that was called **git-notes**. That UI now lives in the app folder of this repo. To simplify things, the Websocket and server connections aren't encrypted, not a big deal since they only run inside this container and it's not designed to be deployed anywhere.

Since the Free tier of Heroku is going away in November of 2022, i decided to repackage this project as a Docker container. When it's running locally, it exposes the following:

- [localhost:3000][xoc-app] - _the Vue app_
- [localhost:8082][xoc-wss] - _websocket server_
- [localhost:8182][xoc-api] - _api server (REST)_

## docker

To run this multi-part app:

1. `docker-compose build`
2. `docker-compose up`

```
➜ proto-notes-dkr git:(main) ✗ docker-compose up
[+] Running 3/2
⠿ Network proto-notes-dkr_backbone Created 0.0s
⠿ Container proto-notes-dkr-api-1 Created 0.0s
⠿ Container proto-notes-dkr-app-1 Created 0.0s
Attaching to proto-notes-dkr-api-1, proto-notes-dkr-app-1
proto-notes-dkr-api-1 | yarn run v1.22.19
proto-notes-dkr-api-1 | $ yarn; node app.mjs
proto-notes-dkr-api-1 | [1/4] Resolving packages...
proto-notes-dkr-app-1 | yarn run v1.22.19
proto-notes-dkr-app-1 | $ yarn; vite build; vite preview --host 0.0.0.0
proto-notes-dkr-api-1 | success Already up-to-date.
proto-notes-dkr-api-1 | -- Notes Server listening on port 8182
proto-notes-dkr-api-1 | -- Websocket Server created on port 8082
proto-notes-dkr-api-1 | -- http://localhost:8182
proto-notes-dkr-app-1 | [1/4] Resolving packages...
proto-notes-dkr-app-1 | [2/4] Fetching packages...
proto-notes-dkr-app-1 | [3/4] Linking dependencies...
proto-notes-dkr-app-1 | [4/4] Building fresh packages...
proto-notes-dkr-app-1 | vite v3.1.3 building for production...
proto-notes-dkr-app-1 | transforming...
proto-notes-dkr-app-1 | ✓ 101 modules transformed.
proto-notes-dkr-app-1 | rendering chunks...
proto-notes-dkr-app-1 | dist/assets/favicon.db74ab0b.ico 4.19 KiB
proto-notes-dkr-app-1 | dist/index.html 1.37 KiB
proto-notes-dkr-app-1 | dist/assets/index.4a29606e.css 1.24 KiB / gzip: 0.52 KiB
proto-notes-dkr-app-1 | dist/assets/index.3fed08c7.js 92.85 KiB / gzip: 35.48 KiB
proto-notes-dkr-app-1 | ➜ Local: http://localhost:3000/
proto-notes-dkr-app-1 | ➜ Network: http://172.18.0.3:3000/
```

If you prefer, there are yarn commands to handle all of this:

- `yarn build` - _docker-compose build_
- `yarn start` - _docker-compose up_
- `yarn stop` - _docker-compose down_

These scripts are just a shortcuts to running `docker-compose`.

You will notice that we're not installing any npm packages locally in order to build and run this app suite. All of that is handled by Docker...

## requirements

- [Docker Desktop for OSX][docker-osx]
- [Docker Desktop for Windows][docker-win]

## who

- Richard Hess
- [https://eswat2.github.io][eswat2-io]

[eswat2-io]: https://eswat2.github.io
[xoc-app]: http://localhost:3000
[xoc-wss]: http://localhost:8082
[xoc-api]: http://localhost:8182

[docker-osx]: https://docs.docker.com/docker-for-mac/
[docker-win]: https://docs.docker.com/docker-for-windows/