lotr-api icon indicating copy to clipboard operation
lotr-api copied to clipboard

Updates dev environment to use docker

Open iisisrael opened this issue 2 years ago • 8 comments

Addresses issue #115

iisisrael avatar Dec 14 '23 00:12 iisisrael

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

iisisrael avatar Dec 14 '23 02:12 iisisrael

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.

MateuszKikmunter avatar Dec 14 '23 10:12 MateuszKikmunter

@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 avatar Dec 14 '23 16:12 iisisrael

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

> [email protected] 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...

iisisrael avatar Dec 14 '23 21:12 iisisrael

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

> [email protected] 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

MateuszKikmunter avatar Dec 15 '23 11:12 MateuszKikmunter

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

iisisrael avatar Dec 15 '23 19:12 iisisrael

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

Nice, thanks for looking at it!

MateuszKikmunter avatar Dec 15 '23 20:12 MateuszKikmunter

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

MateuszKikmunter avatar Dec 15 '23 20:12 MateuszKikmunter

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

gitfrosh avatar Apr 15 '24 20:04 gitfrosh