Code Monkey home page Code Monkey logo

railway_django_stack's Introduction

railway_django_stack

Deploy on Railway

Full Django/Postgres stack with Celery tasks and Redis as cache/queue.

Overview

Deploy a "complete" Django setup - DB, caching and background tasks with Celery are all set up and ready to go.

Check out the full readme and brief on GitHub: https://github.com/Antvirf/railway_django_stack

Deploying the template

  1. In the deployment screen, you will need to configure a DJANGO_SECRET_KEY. You can use the below snippet to do that or otherwise generate your own.

    Snippet to create secret

    This assumes your default python installation has Django installed.

    python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
  2. Once the containers have been deployed, please take the following steps to delete public proxy addresses, as you will not need to access the private services directly:

    • Go to the Postgres service > Settings > Networking, delete the proxy
    • Go to the Redis service > Settings > Networking, delete the proxy

Resources

This template deploys:

  • 1 service running Django
  • 1 service running Celery (same as container #1 but with different startup command)
  • 1 service running Redis
  • 1 service running Postgres

You can test the setup locally with docker compose:

git clone https://github.com/Antvirf/railway_django_stack
cd railway_django_stack
docker-compose up

Service diagram

Warning Please check the instructions above on deploying the template. By default, Railway creates publicly available proxies for your Postgres and Redis services - make sure to delete them. Should you ever need direct access, creating the proxies is just a few clicks.

flowchart LR

subgraph rwp["Your Railway Project"]
    subgraph public["Publicly exposed services"]
        django["App container\n(Django server)"]
    end
    subgraph private["Private services"]
        celery["App container\n(Celery worker)"]
        psql["PostgreSQL"]
        redis["Redis"]
    end
end

users["Users"] --> django
django --> celery
django --> psql

celery --> psql
celery --> redis
django --> redis

Django project setup

This is a barebones Django-project with the following additions/updates:

  • Configures a PostgreSQL database
  • Configures a Redis cache
  • Configures Celery, and installs the following add-on apps:
  • Uses python-decouple to manage settings via environment varialbes
  • Uses whitenoise to make serving static assets easy
  • Installs and runs with gunicorn

railway_django_stack's People

Contributors

antvirf avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

syyunn lus24

railway_django_stack's Issues

Cost estimate

Nice template, curious to understand what's the base running cost for this solution?

Do you also foresee any issues adding flower dashboard or running this for high-availability production systems?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.