forked from agenciavoolu/directus-railway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2afdd28
Showing
14 changed files
with
202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
# Always increase the version requirement | ||
# to match the new version. | ||
versioning-strategy: increase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/node_modules | ||
.env | ||
data | ||
database | ||
uploads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Explicitly specify a Directus version to use on Railway | ||
FROM directus/directus:10.8.2 | ||
|
||
USER root | ||
RUN corepack enable | ||
USER node | ||
|
||
# Installing contributed/custom extensions through npm on Railway | ||
RUN pnpm install directus-extension-computed-interface && pnpm install directus-extension-upsert && pnpm install directus-extension-wpslug-interface && pnpm install pg | ||
|
||
# Uncomment this if you would like to install contributed/custom extensions through the extensions folder on Railway | ||
#COPY ./extensions /directus/extensions | ||
|
||
COPY ./config.js /directus/config.js | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: Directus (Docker + extensions + websocket) + PostGIS (Docker & TCP) + S3 | ||
description: A one-click-install Directus instance with PostGIS and S3 for persistent storage. | ||
tags: | ||
- Directus | ||
- Typescript | ||
- Vue | ||
- Websocket | ||
- CMS | ||
- Data Platform | ||
- PostgreSQL | ||
- PostGIS | ||
- Railway | ||
--- | ||
|
||
# Directus railway template | ||
|
||
This example runs a [Directus](https://directus.io/) instance with minimal config using PostGIS. | ||
|
||
[](https://railway.app/template/zAZIod?referralCode=OYCuBb) | ||
|
||
## ✨ Features | ||
|
||
- Directus config is pre-configured | ||
- Install Directus using Docker | ||
- Directus extensions and websocket are pre-configured | ||
- Directus version can be updated through Dockerfile | ||
- Directus extensions can be updated and loaded through Dockerfile | ||
- PostGIS config is pre-configured | ||
- SSL certificates is pre-configured using the self-signed Snakeoil certificate for PostGIS | ||
- Railway Database View is pre-configured | ||
- Install PostGIS instead of Postgre as Directus recommended for supporting GIS features | ||
- S3 for persistent storage | ||
- docker-compose.yml is added for local development | ||
- The communication from Directus to the database is accomplished through the private network, saving its users from egress fees. This reduces the users' exposure to unnecessary egress fees. | ||
|
||
## 💁♀️ How to use | ||
|
||
- Click the Deploy on Railway button | ||
- Let railway deploy your service, most of the configurations have been preset, but feel free to tweak them as you like before deployment. | ||
- Login in the admin panel using the defined ADMIN_EMAIL and ADMIN_PASSWORD. | ||
- Use of S3 is a must in this template. | ||
- For local development, just run `docker compose up` or run the same command twice (Sometimes, the Directus container starts before other containers are ready, resulting in a failure upon startup). | ||
|
||
|
||
## 💁♀️ Example screenshots | ||
|
||
**Directus extensions** | ||
|
||
 | ||
|
||
**Directus S3 image upload** | ||
|
||
 | ||
|
||
**Directus S3 storage** | ||
|
||
 | ||
|
||
**Railway Database View for Postgis** | ||
|
||
 | ||
|
||
## 📝 Notes | ||
|
||
- This is a minimal one-click-deploy solution to Directus, see [Directus docs](https://docs.directus.io/getting-started/introduction.html) to config it to your needs. | ||
|
||
## Credit | ||
|
||
- Inspired and learnt from [https://github.com/freekrai/directus-railway](https://github.com/freekrai/directus-railway) and [https://railway.app/template/postgis](https://railway.app/template/postgis) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export default function (env) { | ||
return { | ||
// Railway inputs | ||
ADMIN_EMAIL: env.ADMIN_EMAIL, | ||
ADMIN_PASSWORD: env.ADMIN_PASSWORD, | ||
KEY: env.KEY, | ||
SECRET: env.SECRET, | ||
|
||
// https://docs.railway.app/guides/public-networking#railway-provided-port | ||
PORT: env.PORT, | ||
|
||
PUBLIC_URL: `http://0.0.0.0:${env.PORT}`, | ||
|
||
// Database & storage variables for connecting to PostGIS and S3/local storage | ||
DB_CLIENT: 'pg', | ||
DB_CONNECTION_STRING: env.DB_CONNECTION_STRING, | ||
STORAGE_LOCATIONS: env.STORAGE_LOCATIONS, | ||
STORAGE_S3_DRIVER: env.STORAGE_S3_DRIVER, | ||
STORAGE_S3_KEY: env.STORAGE_S3_KEY, | ||
STORAGE_S3_SECRET: env.STORAGE_S3_SECRET, | ||
STORAGE_S3_REGION: env.STORAGE_S3_REGION, | ||
STORAGE_S3_BUCKET: env.STORAGE_S3_BUCKET, | ||
STORAGE_S3_ENDPOINT: env.STORAGE_S3_ENDPOINT, | ||
WEBSOCKETS_ENABLED: env.WEBSOCKETS_ENABLED, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# For local development, you can use the following docker-compose.yml file: | ||
version: "3" | ||
services: | ||
database: | ||
image: postgis/postgis:13-master | ||
# Required when running on platform other than amd64, like Apple M1/M2: | ||
platform: linux/amd64 | ||
volumes: | ||
- ./data/database:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: "directus" | ||
POSTGRES_PASSWORD: "directus" | ||
POSTGRES_DB: "directus" | ||
|
||
cache: | ||
image: redis:6 | ||
|
||
directus: | ||
image: directus/directus:10.8.2 | ||
ports: | ||
- 8055:8055 | ||
volumes: | ||
- ./database:/directus/database | ||
- ./uploads:/directus/uploads | ||
- ./extensions:/directus/extensions | ||
depends_on: | ||
- cache | ||
- database | ||
environment: | ||
KEY: "255d861b-5ea1-5996-9aa3-922530ec40b1" | ||
SECRET: "6116487b-cda1-52c2-b5b5-c8022c45e263" | ||
|
||
DB_CLIENT: "pg" | ||
DB_HOST: "database" | ||
DB_PORT: "5432" | ||
DB_DATABASE: "directus" | ||
DB_USER: "directus" | ||
DB_PASSWORD: "directus" | ||
|
||
CACHE_ENABLED: "true" | ||
CACHE_STORE: "redis" | ||
REDIS: "redis://cache:6379" | ||
|
||
ADMIN_EMAIL: "[email protected]" | ||
ADMIN_PASSWORD: "d1r3ctu5" | ||
|
||
EXTENSIONS_AUTO_RELOAD: "true" | ||
|
||
# Make sure to set this in production | ||
# (see https://docs.directus.io/self-hosted/config-options#general) | ||
# PUBLIC_URL: "https://directus.example.com" |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"$schema": "https://schema.up.railway.app/railway.schema.json", | ||
"build": { | ||
"builder": "NIXPACKS", | ||
"nixpacksPlan": { | ||
"phases": { | ||
"setup": { | ||
"nixPkgs": [ | ||
"...", | ||
"gcc", | ||
"python311" | ||
], | ||
"aptPkgs": [ | ||
"build-essential", | ||
"glibc-source" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |