forked from OS2iot/OS2iot-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/docker setup cleanup #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rimi-itk
wants to merge
9
commits into
feature/docker-setup
Choose a base branch
from
feature/docker-setup-cleanup
base: feature/docker-setup
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ffdd3f6
Git ignored secrets
rimi-itk 060da57
Updated healthcheck on frontend service
rimi-itk 6bed107
Made ChirpStack setup non-optional
rimi-itk 05b661d
Fixed PostgreSQL init files permissions and line endings
rimi-itk 12c8216
Simplified automatic API key management
rimi-itk 6cb485f
Development setup
rimi-itk 4a68cda
Cleaned up
rimi-itk 96e046d
Fixed volume target path
rimi-itk 0a0ea73
Run jq in docker
rimi-itk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # PostgreSQL init script must use LF as line endings | ||
| # Run `git ls-files --eol` to view applied attributes | ||
| configuration/os2iot-postgresql/initdb/*.sh text eol=lf | ||
| configuration/postgres/initdb/*.sh text eol=lf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| .idea/ | ||
| .env | ||
| ca.srl | ||
| ca.crt | ||
| ca.key | ||
| server.crt | ||
| server.key | ||
| server.csr | ||
| server.csr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # Development | ||
|
|
||
| > [!WARNING] | ||
| > This document is still work in progress. | ||
|
|
||
| Start backend and frontend in development mode (cf. [`docker-compose.development.yml`](docker-compose.development.yml)): | ||
|
|
||
| ``` shell | ||
| task dev:start | ||
| task setup:chirpstack | ||
| ``` | ||
|
|
||
| Nginx now exposes the frontend on <http://127.0.0.1:8888/> and the backend (API) on <http://127.0.0.1:8888/api/>, e.g. | ||
| <http://127.0.0.1:8888/api/v1/docs>. | ||
|
|
||
| > [!NOTE] | ||
| > You may have to wait quite a while until everything is up and running. And you may have to reload in your browser a | ||
| > couple of times … | ||
|
|
||
| Check the status development services: | ||
|
|
||
| ``` shell | ||
| task dev:status | ||
| curl http://0.0.0.0:8888 | ||
| curl http://0.0.0.0:8888/api/v1/docs | ||
| ``` | ||
|
|
||
| ## Frontend | ||
|
|
||
| > [!WARNING] | ||
| > Incomplete section ahead! | ||
|
|
||
| Built with Angular. | ||
|
|
||
| ## Backend | ||
|
|
||
| > [!WARNING] | ||
| > Incomplete section ahead! | ||
|
|
||
| Built with [Nest (NestJS)](https://docs.nestjs.com/). | ||
|
|
||
| ``` shell | ||
| task dev:log SERVICE=backend | ||
| ``` | ||
|
|
||
| ### Add new entity | ||
|
|
||
| 1. Create a new class in `src/entities`, e.g. | ||
|
|
||
| ``` node | ||
| // src/entities/contact-person.entity.ts | ||
| import { DbBaseEntity } from "./base.entity"; | ||
|
|
||
| @Entity("contact_person") | ||
| export class ContactPerson extends DbBaseEntity { | ||
| // … | ||
| } | ||
| ``` | ||
|
|
||
| 2. Add the entity to `TypeOrmModule.forFeature` in `src/modules/shared.module.ts`: | ||
|
|
||
| ``` node | ||
| // src/modules/shared.module.ts | ||
|
|
||
| @Module({ | ||
| imports: [ | ||
| TypeOrmModule.forFeature([ | ||
| // … | ||
| ContactPerson, | ||
| ]), | ||
| // … | ||
| ``` | ||
|
|
||
| 3. Generate a migration: | ||
|
|
||
| ``` shell | ||
| docker compose --project-name os2iot-docker exec os2iot-backend npm run generate-migration src/migration/name-of-migration | ||
| ``` | ||
|
|
||
| ### Add entity property (in API) | ||
|
|
||
| ``` shell | ||
|
|
||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| Talk to the database: | ||
|
|
||
| ``` shell | ||
| docker compose --project-name os2iot-docker exec os2iot-postgresql psql os2iot os2iot | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| services: | ||
| os2iot-frontend: | ||
| # https://mherman.org/blog/dockerizing-an-angular-app/ | ||
| build: | ||
| dockerfile: "Dockerfile" | ||
| volumes: | ||
| - '../OS2IoT-frontend:/app' | ||
| - '/app/node_modules' | ||
|
|
||
| os2iot-backend: | ||
| build: | ||
| target: dev | ||
| volumes: | ||
| - '../OS2IoT-backend:/app' | ||
| - '/app/node_modules' | ||
|
|
||
| nginx: | ||
| ports: | ||
| - "8888:80" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use the nginx as proxy to have the same setup as production, where /api is proxied to the backend