Skip to content
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

Migrate to Symfony #13

Merged
merged 59 commits into from
Jun 1, 2021
Merged

Migrate to Symfony #13

merged 59 commits into from
Jun 1, 2021

Conversation

inverse
Copy link
Contributor

@inverse inverse commented Apr 25, 2021

WIP - lots needs to be done

  • Migrate all pages
  • Remove src-f3 before merge

@paulotruta
Copy link
Member

I checked out the branch on the box, trying to access the page gives a 403 Forbidden. Logs say:

[Mon Apr 26 15:51:06.684317 2021] [autoindex:error] [pid 22] [client 172.23.0.6:32926] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive

I noticed there is no index.php in the src folder, but there is one on the public child folder.
image

  • Can you give me some pointers on how can I run it?
  • Should I also run the usual composer install on the container right?
  • Is there any symfony specific command I should run as well?

Overall, looking at the code without testing, looks really good, organized, nothing so different from even what we had in f3, except now having the power of symfony behind to do powerful things with it :D

Also, doing EdgeboxioApiConnector as a pure-curl based class made things easier there. Just port the class as a helper and done :)

Looking at this I would say we'll be able to finish this PR really fast 👍

@paulotruta
Copy link
Member

paulotruta commented May 1, 2021

Now looking at booting up the DB. I see that our symfony .env file contains a DB connection to sqlite:
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"

Was thinking about our conversation the other day around how sqlite is the portable de-facto db format, ideal for data portability and ease of use. Also probably ending up requiring less resources than running intensive MySQL instances for each one of the services the user will eventually have running.

What do you think of using sqlite within symfony, and have the db being saved in the appdata folder within ws. We could then adopt this strategy for other containers we work futurely.
Edgeboxctl would then be able to easily access the sqlite database and add/update information as necessary.

@inverse
Copy link
Contributor Author

inverse commented May 1, 2021

sqlite could be a nice store for storage and simplifies the stack a lot indeed.

Home Assistant ships with it by default :)

@paulotruta
Copy link
Member

@inverse , I checked and currently the commands we are running on a post fresh install (after setting up the container for the first time) are:

docker-compose exec -T -w /var/www/html api-ws composer install
docker-compose exec -T api-ws chmod -R 777 /var/www/html/var/cache

What other commands do we need to run?
I'm thinking about the symfony migrations, and any initial setup commands that would be needed.

@inverse
Copy link
Contributor Author

inverse commented May 31, 2021

Damn - you're on fire!

Oh one thing we would need is to create the database in the first place! so doctrine:schema:create Also how is the DB accessible between the two containers? right now this will put it in var/app.db should we have it elsewhere?

@paulotruta
Copy link
Member

Oh one thing we would need is to create the database in the first place! so doctrine:schema:create

Will add this one. (I also need to get a new raspberry pi, to be able to do fresh install tests without bringing down my current setup 😁)

Also how is the DB accessible between the two containers? right now this will put it in var/app.db should we have it elsewhere?

Yeah, this is a tricky one 😅 would probably let it be in that directory, but create volume mappings for storing logs and the database to the components/ws/appdata/api-ws/ directory on the host machine.

Will look closely into this next.

@paulotruta
Copy link
Member

Made small changes to the templates here, in conjuntion with a new pull request for edgeboxctl, so Edgeapp packages can support a two / three word descriptor of what the app does. The objective is that it results in an easier to use experience for the less tech savvy (that don't want to memorize all the possible app names and what they are for). Example screenshot below:

image

Pull request for edgeboxctl here: edgebox-iot/edgeboxctl#9

@paulotruta
Copy link
Member

Changed the whole symfony var folder to be a volume placed in the host system ws's appdata folder, and changed the necessary .env file variables to point to the correct placement.

edgeboxctl picks the database up correctly and writes to it (given that you're running it as sudo, which will be the case as it runs as a service)

Will now remove all MySQL related stuff from here, last step!

@paulotruta
Copy link
Member

image

Ok after testing a bit more, noticed that there seems to be a problem with the db permissions.
Symfony cannot write to it, only read :/

Looking into what can be done about this.

@paulotruta
Copy link
Member

Solved! 🎉

Don't like much giving 777 permissions on the folder, but surely works properly now. A fresh install with the Edgebox OS installer should work properly and give you access to the dashboard.

We can work on this on more detail later :)

Copy link
Member

@paulotruta paulotruta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're ready to merge this to the main branch. It is already substantially better than what's there.

I also merged edgeboxctl sqlite support into the main branch as well :)

@paulotruta paulotruta linked an issue Jun 1, 2021 that may be closed by this pull request
@inverse inverse merged commit 1e7a80b into main Jun 1, 2021
@inverse inverse deleted the symfony branch June 1, 2021 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit tests for the project
2 participants