An express app that uses built-in features from Coder environments and coder-cli to do some cool "automated" stuff outside of Coder's main U.
This is just a simple express app with Pug view engine. Here's what's important to understand in this demo app:
bin/www - web server (nothing special to Coder)
app.js - controls express & routes (nothing special to Coder)
routes/index.js - uses env variables and coder-cli to get info about:
- the current environment (env vars)
- all Coder environments by the environment owner
- all Coder images
routes/actions.js - actually modifies stuff in a Coder deployment (create environment, run command, etc)
views/index.pug - renders the index page and displays the Coder info
Ideally, this is installed in a Coder environment. Here's why:
- CODER Environment variables will be injected for context on the Coder environment/user.
- coder-cli will already be installed
However, the create/command exec functionality could work on any system with coder-cli installed.
- [If using Coder]: Use an image with Node installed. We recommend codercom/enterprise-node:ubuntu in the Docker Hub.
- Clone this repo
- npm install
- To run the web app, npm start
- [If using Coder]: Open a Dev URL on port 3000 to access the web app
Contributions are welcome 🙂
