Closed zifredder closed 1 year ago
Hi, sure I can help. I have created an empty repo: https://github.com/syncloud/grocy I can give you permissions to push to it also add it tou our build server. First of all I would copy the whole nextcloud into it and start removing nextcloud specific things.
Thanks for adding me to the repository!
And sorry for the delay. It took me quite some time to build up the motivation to dive into this task and then find the time to do the dive ... right now, after about 12 hours of diving, I am still completely lost.
There are too many layers, too many components and concepts that are new to me: Nginx
, snap
, php
, Drone CI
, Syncloud itself, ... Understanding them separately is OK, but figuring out which part of each technology is integrated with which parts of the other technologies is pretty hard -- for me, at least, having no experience in this field at all.
What I think I understood:
.drone.jsonnet
..snap
file..snap
can then be installed as an application inside Syncloud and can be accessed via [app].[user].syncloud.it... And that's basically it. I can't figure out the details of packaging the app as a .snap
.
According to grocy/how-to-install, we need to download a release and unpack it, so this is one thing that the snap package needs to contain. The download is done in /download.sh
, which would put the application files into /build/snap
. I am puzzled as to what is supposed to happen in /build.sh
: Does it just copy all other snap-relevant files into the build directory? /package.sh
seems to do the packaging, producing the snap
file.
Apropos snap-relevant files:
/bin
: service start scripts": What are those for Grocy? grocy/public/index.php seems to be the entry point, so ... how do we start the app?/config
: app configs": Are those the configuration files for Grocy as the snap application, or internal Grocy configs? I think it is the latter. Grocy configs are located in /grocy/data/config.php
, so how do we link the two? Should Grocy get the file from somewhere else, or the other way around? How/where can we configure that?/hooks
: How do I find out what needs to be done during installation? Looking at Nextcloud's installer-hook, most of the steps seem to be Nextcloud-specific./meta/snap.yaml
: I guess the nginx service is necessary, similar to the Nextcloud config. But what else? I guess to answer this question I need to find out how Grocy is working internally.Grocy can also be run using Docker. Would this make it easier? I've seen that e. g. Python is built via a Docker image, so this should work for Grocy as well, shouldn't it? But again, I can't figure out how to plug a Docker image into a snap package ...
I don't know how to continue. Do any of you Syncloud-people have time to help? Should I ask the Grocy community?
Regards :v:
download.sh
is usually for downloading stage (whatever we need from outside world)
build.sh
depending the language used compile or some transformation needed to downloaded files
package.sh
puts last bits into build/snap
like bin
/config
... and is mostly stays as is in all the repos as it creates a snap of build/snap
you are right about docker we are now taking most of the tools and sometimes even the app itself from their docker containers, the only requirement is it should be available for 3 architectures (amd64, arm64 and arm/v7) Which is not the case for https://hub.docker.com/u/grocy (not even sure which one to use (grocy/frontend/backend) probably all). But is the case for https://hub.docker.com/r/linuxserver/grocy/tags
Again depending on a language it may save or add time. PHP is a dynamic language so it does not require a compilation so you are not really saving anything by getting their docker images. Docker probably contains PHP itself which we usually take directly from PHP docker containers provided by php themselves (as you can see in our Nextcloud app https://github.com/syncloud/nextcloud/tree/master/php)
Then PHP is usually served by a tool called FPM which is part of PHP and we use it as a service: https://github.com/syncloud/nextcloud/blob/master/bin/service.php-fpm.sh
FPM and other app/tools configs are located in /config
dir and copied to a writable dir during the install as system may need to modify them on domain change event for example: https://github.com/syncloud/nextcloud/blob/master/hooks/installer.py#L68
Nginx is actually serving all the requests and delegating php parsing to FPM: https://github.com/syncloud/nextcloud/blob/master/config/nginx.conf#L21
The good thing in all this as I am trying to maintain some level of functional and UI tests which are easy to copy from app to app (https://github.com/syncloud/nextcloud/tree/master/integration)
That means all you really need to do is to copy Nextcloud contents remove/rename all occurrences of nextcloud
to grocy
make sure this test is there (https://github.com/syncloud/nextcloud/blob/master/integration/verify.py#L72) and push it
Then build server will actually drive you by giving many error messages, when you fix them all with my help we can move to adding a UI test with makes sure user can login and do something https://github.com/syncloud/nextcloud/blob/master/integration/test-ui.py
Thanks! I'm trying around right now ...
That means all you really need to do is to copy Nextcloud contents remove/rename all occurrences of
nextcloud
togrocy
Did this while deleting stuff that I am confident is Nextcloud-specific, such as occ
and nextcloud.cron
-related things. I hope I didn't remove anything important. :shrug:
Should I fork and open a PR or do you give me permission to push?
No worries we can always add it back. You should be able to push it, first version we can do on master, later we can do PRs.
Still can't push. :thinking:
$ git push
ERROR: Permission to syncloud/grocy.git denied to zifredder.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
$ git remote -v
origin git@github.com:syncloud/grocy.git (fetch)
origin git@github.com:syncloud/grocy.git (push)
$ git pull
Already up to date.
$ git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
Try now
Worked. :heavy_check_mark:
However, I'm having problems getting drone
to work. I have 0 experience with drone
and very limited knowledge of build pipelines.
$ drone --version
2023/01/10 19:51:46 proto: duplicate proto type registered: PluginSpec
2023/01/10 19:51:46 proto: duplicate proto type registered: PluginPrivilege
drone version 1.6.2
$ drone jsonnet --stream
2023/01/10 19:32:24 proto: duplicate proto type registered: PluginSpec
2023/01/10 19:32:24 proto: duplicate proto type registered: PluginPrivilege
$ head .drone.yml
---
{
"kind": "pipeline",
"name": "amd64",
"platform": {
"arch": "amd64",
"os": "linux"
},
"services": [
{
So far so good? However, nothing happens when I try to build locally:
$ sudo drone exec --pipeline=amd64 --trusted
2023/01/10 19:56:15 proto: duplicate proto type registered: PluginSpec
2023/01/10 19:56:15 proto: duplicate proto type registered: PluginPrivilege
There's nothing happening. Do I have to have all the tools installed locally?
My drone installation seems to have some issues ... according to documentation the following should work.
$ cat .test_drone.yml
kind: pipeline
type: docker
name: default
steps:
- name: test
image: alpine
commands:
- echo hello
- echo world
$ drone exec .test_drone.yml
2023/01/10 20:19:49 proto: duplicate proto type registered: PluginSpec
2023/01/10 20:19:49 proto: duplicate proto type registered: PluginPrivilege
No stage specified, assuming 'default'
But there's just nothing happening. Any thoughts on this? I can't find anything helpful about that proto
message.
Just cloned the repo and did this:
cd grocy
../drone jsonnet --stream
sudo ../drone exec --pipeline=amd64 --trusted
It started to build.
Is this drome a command line tool from https://docs.drone.io/cli/install
What version is it drone --help | head
Ok tried downloading myself, new version 1.6.4 produces this error and does nothing, let me google
Ok, it actually works, this message is just a warning. I guess if you do not see other logs it may be downloading docker image to rung the step on, how long did you wait?
Another thing I have enable this repo on our build server if you oush something it will build: http://ci.syncloud.org:8080/syncloud/grocy
Hey, did some cleanup, added config with ldap. Here is the PR if you want to see the difference and merg it: https://github.com/syncloud/grocy/pull/1/files
Wow, you changed quite a bit! Thanks! :star_struck:
It is already working, isn't it? The stable
build is currently running; will it automatically be available in the snap store as soon as the build is finished, or should I manually download and install the snap package and test it?
Yeah it will be available semi automatically I will need push a promote button. I will let you know
Ok, released, check the app store. Open new issue for any new problem.
Would it be possible to include grocy as an app? It already exists as an add-on for home assistant (https://grocy.info/addons), but Syncloud's home assistant instance is of type
core
, which does not allow installing add-ons (or did I miss something?).I would love to contribute something to this task, but I don't have the slightest clue where to start. I know most words in the app porting guide, however unfortunately I cannot make sense of the sentences because I have no idea how a server even works.
and
indicate to me that this is probably doable, but unfortunately this is where it ends ...
In any case, thank you so much for making Syncloud!