Add docker development environment #1
Closed
lil5
wants to merge 6 commits from lil5:docker
into main
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'lil5:docker'
Deleting a branch is permanent. It CANNOT be undone. Continue?
This uses docker to keep things consistent across platforms and create an easier way to get started.
Thank you for looking into this and providing this patch.
Since you are heavily using third-party dependencies, please either drop them or indicate that this guide is not audited or maintained by Codeberg but the community, and people should use everything outside the official instructions (= install go and do
make
) at their own risk.$ docker-compose up -d backend
```
**6. Start frontend**
the app serves the frontend itself, I do not understand why you add this step. Even if this might be more convenient, it's definitely not a requirement at all!
As per:
Right I'll make some more changes to fix that, the documentation is not very explanitory conserning structure.
I don't even get how your change is supposed to work, as it uses a different port and the frontend can't possibly find the backend, can it?
The way the frontend is served is probably subject to change anyway. I'm considering to use templates e.g. to insert the app name there, or render some basic information (like recent actions), so it's also available to noscript users. In the future, it'll surely also be beneficial to compile the JS into a single file, but I won't deal with that until the app is actually usable and going to be deployed somewhere.
In docker a container has each, other, service listed in its host file thus they can talk directly using the service name.
This is the reason the url of the gitea must be changed to
URL = http://gitea:3000
just like:Anyway the frontend step has now been removed and the backend service now includes the root project to allow go to read
'../frontend'
.services:
gitea:
image: gitea/gitea:1.16.5
let's not hardcode this, if possible, but always stick to latest.
Done
volumes:
- .:/usr/src/myapp
working_dir: /usr/src/myapp
command: sh -c 'go install github.com/githubnemo/CompileDaemon@v1.4.0 && CompileDaemon -exclude-dir=.git -exclude-dir=.gitea -build="go run ."'
What does that third-party dependency do?
I use it to live reload a
go run .
command on.go
file changes.code.gitea.io/gitea-vet v0.2.1/go.mod h1:zcNbT/aJEmivCAhfmkHOlT645KNOf9W2KnkLgFjGGfE=
this seems to be an unrelated change, and while exact version locking might be fine for releasing this into production, I don't think we should track these large files during the current development (bootstrapping) phase.
That conserns me why you would want to do that. Lock files keep devs from dealing with possible bugs relating to different versions used, keeping that to a minimum sounds like a good thing, on top of that how many KBs are we talking about?
I'm not going to argue about that. I still prefer to leave it out during the bootstrapping period, because lockfiles also have to be maintained, and include it once the project is mature.
We are talking about exactly 8.2KB 🙃
SUSPICIOUS_USER_KEYWORDS = comma, separated, list
[repos]
QUARANTINE_OWNER = owner_which_holds_quarantine
the changes to this file are minimal, why can't we instead use the existing example configuration? Feel free to adapt the placeholders to those you need for docker, as long as they still convey the same meaning.
This should be fixed, I've removed the duplicate
moderation_backend.docker.ini
# Development
This uses docker to keep things consistent across platforms and create an easier way to get started.
Uh oh I think I found a Gitea bug - one of my comments weren't saved (I can't see it at least). Anyway, I wrote to this step that docker is definitely not necessary for most GNU/Linux users (and we won't support anything else). While you can run the app in docker if you prefer, I'd appreciate if you could separate the general steps from those specific to docker.
The non-docker part is
make
ormake run
after installing Go.@lil5 I read your comment via email. No, I don't object to docker in general, in fact I use it for most of my own server stuff. I don't mind adding a way to simply use docker if someone prefers, but I don't like telling users that it's "the" way, because for this project I honestly think it's even easier without, so I'd prefer to have it as an option, but not as "the" option 😉
Small heads-up: I just pushed likely conflicting changes, but I included some of your changes in the default ini file. Since you don't (yet?) provide a simple mailer, I left the mail section untouched.
I have changed the texts to note that it is unofficial.
Thank you.
I'll probably try to adjust the development guide to something official soon and add some more notes from my side, or make the whole project more easy to newcomers anyway. Thank you for the start. Anything left, if not I'll merge this later today.
Hmm, manual merge detection is broken :-/
Anyway, I just merged it now. Thanks :)
Reviewers