Skip to content

the-syndrome/meltdown-with-directus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy Meltdown with Directus Headless CMS

Meltdown + directus

git clone https://github.com/the-syndrome/meltdown-with-directus.git
cd meltdown-with-directus
touch database/data.db
git clone https://github.com/the-syndrome/meltdown.git app
cp -r pages/* app/src/pages
cp .env.example .env
docker-compose up

By default these services will be up but there are no collections or pages in it yet.

To automatically use the test pages import them with:

npm install --ignore-scripts
npm rebuild esbuild
npm run schema-import
npm run pages-import

Until we can automate it the public user needs access to the pages collection.

  1. http://127.0.0.1:33764/admin/settings/policies
  2. Public
  3. Permissions ➡️ Add Collection: pages
  4. Actions ➡️ Read

access policies 01

access policies 02

Next steps

Edit pages

pages list

Configure Meltdown

If you're finding it useful you can begin to change the values in the .env file documented at https://meltdown.dex.yachts/deploy/environment. It's recommended to change the admin information before moving to production. SSG is particularly useful when deploying.

Configure directus

Directus has flexible configuration allowing for any scale. In this project we run it minimally with sqlite but you can opt for other databases, caching, cloud services, and email. See all directus config options.

Proxying

In this example we only used a basic type of proxying to request pages. If you get committed to directus and want to go deeper you can implement a proxy. The module http-proxy-middleware will be fine in development. In production proxy_pass in nginx or the equivalent in your HTTP server will help serve more from directus like collections, assets, and the rest.

Security

Before going to production the developer should check that secrets from the .env file are not leaked through to the imba bundle.

Backup your schema

npm run schema-export

./tools/schema-{timestamp}.json is created

Backup your pages

npm run pages-export

./tools/pages-{timestamp}.json is created

Directus CLI

As an aside there is a tool that directus has for exporting and importing but while using that system there were some problems. The ./tools scripts were created as a work-around. If you have the ability to troubleshoot and improve this project using the built-in tools we can update with your PR.

# export
docker-compose exec directus npx directus schema snapshot ./snapshot.yaml

# import
docker-compose exec directus npx directus schema apply --yes ./snapshot.yaml
docker-compose exec directus npx directus schema diff --yes ./snapshot.yaml

Resources

The following docs and guides were helpful to make the project, export, and import.

Troubleshooting

File or directory is read-only

In some containers and runtimes the users and permissions aren't clear so you can set read+write for all as a work-around.

chmod -R 0777 database extensions uploads

Reach out for help

Join the Community

About

How to use Meltdown imba template with Directus headless CMS, SSR, SSG, search

Topics

Resources

Stars

Watchers

Forks

Contributors