C9 IDE

A cloud IDE built from C9 SDK

Deploy C9 IDE

Postgres

railwayapp-templates/postgres-ssl:16

Just deployed

/var/lib/postgresql/data

C9 IDE

lequanghuylc/c9sdk-pm2-nginx

Just deployed

Intro

demo

This is a self-hosted IDE / Code editor, built from C9 SDK. With C9 IDE you can set up development environments in the cloud. It comes with nvm, pm2 and nginx that can help you publish your application pulically accessible to the world.

Variable

  • C9SDK_PASSWORD: password for basic auth. it would be publically accessible if this env is not defined
  • GIT_REPO: automatic git repo deployment
  • GIT_BRANCH: target branch, if not present, default branch will be used.
  • INITIAL_COMMAND: (optional) custom command that can be used for installing custom dependencies or even start your git repo your own way
  • GIT_REPO, GIT_BRANCH: (optional) a sample repo running nodejs & react & postgres is added for demo purpose, to show it can run real world application.
  • DOMAIN_NAME: (optional) this env will be used with deployment script in the sample application. if empty, nginx will run the application at port 8081, and you need to use TCP Proxy to get it pulicly accessible (Container settings -> Network)

What is the best use case for this?

  • Online - cross device development. it is an alternative to code-server. it is lighter than code-server which will be more resouce (cost) effective.
  • Run any real world application without Docker (DinD is not yet supported in Railway)
  • Gitlab Runner Shell executor for Gitlab CI/CD

Instructions to run real world application

  • Run your application at some local port. for example: python -m SimpleHTTPServer 9000 to start a static web server at port 9000.
  • Prepare your domain and add to Service settings -> networking. make sure the DNS record is setup.
  • Add a nginx conf files to /etc/nginx/sites-enabled to reserve proxy your application. make sure to use server_name your_domain;
  • Run nginx -t to test your .conf file
  • Run nginx -s reload to apply changes.
  • Your application should be pulically accessible now.

Auto Git Repo Deployment

  • The start script checks the environment variable GIT_REPO (and GIT_BRANCH) and automatically clones and deploys the repository.
  • GIT_REPO should be https url containing access token key
  • The repo will be cloned to /root/the-project.
  • The repo needs to have the following deployment structure, which is:
    • depoyments: folder
      • deploy.sh: suppose to install project deps and start the project
      • setup-cron.sh suppose to setup cron for automatically checking new commit and pull and re-deploy
      • setup-nginx.sh suppose to setup nginx reserve proxy with production domain name

Template Content

More templates in this category

View Template

mellow-vue

A full-stack Vue app with The Boring JavaScript Stack.


View Template

Sveltekit NestJS

Full-stack with SvelteKit + NestJS + Prisma + Postgresql with utils


View Template

.NET8 Web API

A basic ASP.NET Core Web API template (.NET 8)