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

chore(dev): add connection with local directus instance #64

Merged
merged 32 commits into from
Aug 21, 2024

Conversation

Thechi2000
Copy link
Contributor

@Thechi2000 Thechi2000 commented Jun 28, 2024

Allow to use a local Directus instance for development. It uses two environment variables, set in the Dockerfile(.dev) files: DIRECTUS_URL and NEXT_PUBLIC_DIRECTUS_URL.

Provides a script to populate the database locally, as well as save its content.

The permissions for all the collections required by the website are set to read for the Public role, in order to get rid of the authentication token (only for dev).

@Thechi2000 Thechi2000 added docs Improvements or additions to documentation devops Related to production deployment and releases labels Jun 28, 2024
@Thechi2000 Thechi2000 self-assigned this Jun 28, 2024
@Thechi2000 Thechi2000 linked an issue Jun 28, 2024 that may be closed by this pull request
3 tasks
@Thechi2000 Thechi2000 requested a review from NoeTerrier August 16, 2024 15:08
@Thechi2000 Thechi2000 marked this pull request as ready for review August 16, 2024 15:08
Copy link
Contributor

@NoeTerrier NoeTerrier left a comment

Choose a reason for hiding this comment

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

Nice works ! Maybe the documentation on how to setup things should be clear that we need to populate directus. Why not having a setup command to do everything in a row?

I spotted some small bugs, and I don't know it it's a good thing that we need to specify all access policy for each table at hand.

It don't see any partner on the homepage despite we have some in directus, with valid times, can't find why.

@Thechi2000 Thechi2000 force-pushed the 50-directus-development-environment branch from a9efdba to bbd642c Compare August 17, 2024 12:53
@Thechi2000
Copy link
Contributor Author

Thanks for the review ! I've added the missing entries in the sample data to correctly display the partners on the home page.

@Thechi2000 Thechi2000 marked this pull request as draft August 18, 2024 22:17
@Thechi2000
Copy link
Contributor Author

Ok I just had a crazy idea: what if we were to put the Directus config into a dedicated repository, along with all the scripts and data ? This way, we could easily share those among repositories (website, infra, clicketing). We could have symbolic links for typescript declarations, which should work even through git.

I've got a working prototype on the branch 50-directus-development-environment-2, which uses a repo on my personal account, if you want to try it out (the doc is not updated yet).

What do you think ? @SidonieBouthors @NoeTerrier

@SidonieBouthors
Copy link
Contributor

SidonieBouthors commented Aug 19, 2024

Honestly that sounds like a good idea

@NoeTerrier
Copy link
Contributor

Not a bad idea, it should work. But the merging workflow should be ensured: website and directus repo should always be synched. But it will be better for other services too.
I'm down for it if both of you think it's better like that!

@Thechi2000 Thechi2000 force-pushed the 50-directus-development-environment branch from c630e39 to 2ea09a3 Compare August 19, 2024 15:33
@Thechi2000 Thechi2000 marked this pull request as ready for review August 20, 2024 13:38
@Thechi2000 Thechi2000 requested a review from NoeTerrier August 20, 2024 13:38
@Thechi2000
Copy link
Contributor Author

Thechi2000 commented Aug 20, 2024

I've migrated the config to the directus-config repo, don't hesitate to check that it's correct too :)

I'll start working on a PR for the infra repo to use this new workflow.

Copy link
Contributor

@NoeTerrier NoeTerrier left a comment

Choose a reason for hiding this comment

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

Nice, looks good, but I still have this problem with date-created.

image

app/.env.example Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

So we don't use directus token anymore ? How does the website have permission to access data on directus ?
If not then we need to set permissions for collections for public user, wich is a bit annoying:
image

Copy link
Contributor Author

@Thechi2000 Thechi2000 Aug 21, 2024

Choose a reason for hiding this comment

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

Everything is public now (in dev only), this simplifies the setup since we do not need to generate an admin token and give it to Directus. I don't think having to set everything public is much of an inconvenience, it is quick and we won't do it very often.

@Thechi2000 Thechi2000 requested a review from NoeTerrier August 21, 2024 12:40
Copy link
Contributor

@NoeTerrier NoeTerrier left a comment

Choose a reason for hiding this comment

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

Nice !
Well done, I think it is a great upgrade for the infra and the website development.

@Thechi2000 Thechi2000 merged commit f7c5ca8 into main Aug 21, 2024
3 checks passed
@Thechi2000 Thechi2000 deleted the 50-directus-development-environment branch August 21, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops Related to production deployment and releases docs Improvements or additions to documentation
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Directus development environment
3 participants