gitfrosh / lotr-api

This repository holds the code base of the API to rule them all, the Lord of the Rings api, which provides you with book, character, movie and quotes data.
https://the-one-api.dev
238 stars 66 forks source link

Updates dev environment to use docker #117

Closed iisisrael closed 6 months ago

iisisrael commented 10 months ago

Addresses issue #115

iisisrael commented 10 months ago

Forgot to mention, I've only worked on this in a linux environment. I'll boot into windows tomorrow and see what I see.

MateuszKikmunter commented 10 months ago

Hey @iisisrael , nicely done, but there's a PR for TypeScript migration for the backend part, so I'd suggest to wait until it's merged and incorporate TS changes into your PR.

iisisrael commented 10 months ago

@MateuszKikmunter I'm not seeing anything that would have to change here. The TS dependencies are all handled by npm, and the docker environment is happily agnostic, I think? I'll try merging both PRs locally, see what happens.

iisisrael commented 10 months ago

RE: trial merge of this PR and #116...

This is the only file merge that needs to happen:

diff --git a/.gitignore b/.gitignore
index 0026ed3..7d0a66a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,5 @@ docker-compose.yml
 dump
 .DS_Store
 bk
-backend/dist
\ No newline at end of file
+backend/dist
+docker/db

Everything builds and runs, though after signing up the backend crashed - nodemon logs aren't very insightful:

israel@DESKTOP-N8K5LK1:~/dev/forked/lotr-api$ docker container logs lotr-backend-1

> lotr-api-backend@2.1.0 dev
> nodemon server.ts

[nodemon] 3.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts,json
[nodemon] starting `ts-node server.ts`
(node:35) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:35) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
Database Connected
LotR backend listening on port 3001!
[nodemon] app crashed - waiting for file changes before starting...
MateuszKikmunter commented 10 months ago

RE: trial merge of this PR and #116...

This is the only file merge that needs to happen:

diff --git a/.gitignore b/.gitignore
index 0026ed3..7d0a66a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,5 @@ docker-compose.yml
 dump
 .DS_Store
 bk
-backend/dist
\ No newline at end of file
+backend/dist
+docker/db

Everything builds and runs, though after signing up the backend crashed - nodemon logs aren't very insightful:

israel@DESKTOP-N8K5LK1:~/dev/forked/lotr-api$ docker container logs lotr-backend-1

> lotr-api-backend@2.1.0 dev
> nodemon server.ts

[nodemon] 3.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts,json
[nodemon] starting `ts-node server.ts`
(node:35) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:35) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
Database Connected
LotR backend listening on port 3001!
[nodemon] app crashed - waiting for file changes before starting...

Then it's not working entirely I'd say. Let's check if the same happens only with TS code. I'll pull your branch when I have some time and will take a look too as I'm curious what's going on there. In the end we could also get rid of nodemon and watch changes in another way while container is running

iisisrael commented 10 months ago

@MateuszKikmunter solved the crashing, Alpine container architecture doesn't support the bcrypt binary execution.

MateuszKikmunter commented 10 months ago

@MateuszKikmunter solved the crashing, Alpine container architecture doesn't support the bcrypt binary execution.

Nice, thanks for looking at it!

MateuszKikmunter commented 10 months ago

Looks good to me but @gitfrosh pls take a look too.

gitfrosh commented 6 months ago

@iisisrael and @MateuszKikmunter, thanks for this amazing improvement!