# (outdated) Guide to Setting Up Discourse Development Environment - GitHub Codespace

**URL:** https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231
**Category:** Developers
**Tags:** dev-install
**Created:** [May 8, 2024, 10:44am UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231 "2024-05-08T10:44:56Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)
#### Post date: [May 8, 2024, 10:44am UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231/1 "2024-05-08T10:44:56Z")

</div>

> [@](#):
>
> ℹ Discourse core now includes an updated devcontainer configuration, which means the manual steps in the topic are no longer required.
> 
> Check out the official docs here: [Developing Discourse on GitHub Codespaces](https://meta.discourse.org/t/developing-discourse-on-github-codespaces/336131)

* * *

# Developing Using GitHub Codespaces

[GitHub Codespace](https://docs.github.com/en/codespaces/overview) is a great development option. It’s great because it’s hosted in the cloud, I can easily ensure that everyone developing here has the same environment, no dealing with local docker installations, easy access to making my local dev instance available publicly, and also just using new technology is fun.

I’m currently re-learning development and decided to pickup GitHub Codespaces in addition to learning some Discourse development, so I made this guide for anyone else looking to develop on Discourse in GitHub Codespace rather than setting up a local environment.

I decided to write this guide after going through a slew of issues getting this working with GitHub Codespace myself:

> [@Issues attempting to run discourse in GitHub Codespaces](https://meta.discourse.org/t/issues-attempting-to-run-discourse-in-github-codespaces/307189):
>
> Following this post from @cvx on a fresh GitHub codespace install: Running bin/ember-cli -u (FYI for anyone else, you first have to cd into workspace/discourse), nets the following issue:

This guide will assume nothing, so we don’t miss a single step to getting you up and running. I _suspect_ some of this process can be improved at the core repo level for the GitHub Codespace configuration, or at least due to my lack of understanding. Don’t hesitate to point these out.

# Fork the Discourse repository

1. Navigate to `https://github.com/discourse/discourse`  

2. Click the `Fork` button in the top-right of the page and click the green 'Create fork` button on the subsequent page.  

3. After a brief moment, you’ll be taken to your new fork of the discourse/discourse repository:  

# Setup Your GitHub Codespace

1. Click the green `<> Code` button  

2. Switch to the Codespaces tab and click the green `Create codoespace on main` button.  

3. You’ll be taken to a new window where GitHub will start creating your codespace. This should take 1-3 minutes:  
 ![chrome_LYoRTOWojo](https://global.discourse-cdn.com/meta/original/4X/8/3/1/831a2e6a6f106d0d2f3c5ca6cca74012f0a3ffaf.gif)

4. After a few minutes, you’ll be presented with your GitHub Codespace (which is just VS Code in your browser):  

# Setup Your Codespace Environment

There are some configurations to make to your codespace environment before you’re up and running.

1. Create a new bash shell by click `Ctrl + Shift + backtick` on Windows/Linux, or `Cmd + Shift + backtick` on Mac. Your shell should have you starting int he `/var/www/discourse` directory.  

2. Navigate to the discourse directory:

```plaintext
cd workspace/discourse

```

 ![chrome_YzWw7aHvxM](https://global.discourse-cdn.com/meta/original/4X/a/f/5/af58d44fab96b62d6c0fa3be2bf8e4df964c7594.png)

1. Install everything from the project Gemfile

```plaintext
bundle install --gemfile ./Gemfile

```

The command is quite long, but you’ll see something like this:

 ![chrome_IB7yqvARSB](https://global.discourse-cdn.com/meta/original/4X/e/b/6/eb67290e55bef96d5b8dbe56e51c3b8f99efbd0e.png)

1. Add a new config.hosts to the development.rb
  1. From the directory you’re currently in (`/var/www/discourse/workspace/discourse`) open the file `config/environments/development.rb`.
  2. Find the line `config.hosts << /\A(([a-z0-9-]+)\.)*localhost(\:\d+)?\Z/` and create a new line below it with the following, then save the file:

```plaintext
config.hosts << /^(.*)\.app\.github\.dev$/

```

The tail-end of your file should look like this (notice line 102 in my screenshot):

 ![chrome_gMmENBChWD](https://global.discourse-cdn.com/meta/original/4X/4/4/2/4423a716edcf37effc2121f4973abfd3698b8388.png)

1. Back down in your terminal, run `bundle exec rake admin:create` to create your first admin account. The command will ask you to choose an email and a password (password must be at least 10 characters)  
 ![chrome_0AgdDsZCih](https://global.discourse-cdn.com/meta/original/4X/9/7/2/9727fc504ec14f954e623688ecdc6ad8481a711d.png)

# Start Your ~~Engines~~ Server

It will take 1-2 minutes to build and start the server. At this point, you should now have everything you need to run and access your application.

1. In the same terminal you’re in, run the following command to start your server:

```plaintext
bin/ember-cli -u

```

 ![chrome_k13sEIlXL5](https://global.discourse-cdn.com/meta/original/4X/c/9/4/c94c46c57c2346f7c9852bbbe936f4bd82c89865.png)

1. Switch from the `Terminal` tab to the `PORTS` tab in your console:  

2. Click on the `Forwarded Address` for port 4200 using `Ctrl + click` for Windows/Linux, or `Cmd + click` for Mac and you’ll be greeted with your development environment!  

Hopefully this helps someone else in getting started with GitHub Codespaces! 🎉

---

<div class="post-metadata">

### Author: ![Rick\_Jing](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rick_jing/32/354677_2.png) [@Rick\_Jing](https://meta.discourse.org/u/Rick_Jing)
#### Post date: [May 11, 2024, 2:04pm UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231/2 "2024-05-11T14:04:10Z")

</div>

Great, it’s a good option when traveling light

---

<div class="post-metadata">

### Author: ![jordan-violet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jordan-violet/32/281428_2.png) [@jordan-violet](https://meta.discourse.org/u/jordan-violet)
#### Post date: [May 11, 2024, 2:05pm UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231/3 "2024-05-11T14:05:11Z")

</div>

Or in my case, I really don’t want to develop on windows and docker, but also don’t want to switch to a Unix environment at home (though I use one at work).

I just like the idea that everything is right there in my GitHub repo.

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [November 6, 2024, 10:49am UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231/4 "2024-11-06T10:49:41Z")

</div>

I think this guide needs some updating. It doesn’t work when running step 5, since the databases aren’t made yet.

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [November 6, 2024, 11:05am UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231/5 "2024-11-06T11:05:12Z")

</div>

> [@jordan-violet](#):
>
> bundle exec rake admin:create

I managed to get it working by running

```plaintext
bash <(wget -qO- https://raw.githubusercontent.com/discourse/install-rails/main/linux)

```

Then

```plaintext
bin/rails db:create 
bin/rails db:migrate
RAILS_ENV=test bin/rails db:create db:migrate

```

Followed by

```plaintext
bin/ember-cli -u

```

Then in a split terminal

```plaintext
bin/rails admin:create

```

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [November 6, 2024, 11:31am UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231/6 "2024-11-06T11:31:14Z")

</div>

@jordan-violet I assume this is an #unsupported-install? I can’t find my `app.yml`, so I can’t install plugins.

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [November 7, 2024, 12:08pm UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231/7 "2024-11-07T12:08:36Z")

</div>

To install a plugin you can follow the steps in [Install plugins in your non-Docker development environment](https://meta.discourse.org/t/install-plugins-in-your-non-docker-development-environment/205337?silent=true)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [November 7, 2024, 12:18pm UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231/8 "2024-11-07T12:18:42Z")

</div>

You symlink from your plugins folder to the folder of your plugin code

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [November 14, 2024, 12:20pm UTC](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231/9 "2024-11-14T12:20:09Z")

</div>

@jordan-violet thanks for creating this guide with all the workarounds that were previously necessary 🙏

I’m glad to say that we’ve now merged a bunch of changes to our devcontainer/codespaces configuration, which should make it much easier to get things going without needing to fork or manually configure anything.

Here’s the official guide:

> [@Developing Discourse on GitHub Codespaces](https://meta.discourse.org/t/developing-discourse-on-github-codespaces/336131):
>
> [GitHub Codespaces](https://github.com/features/codespaces) is a very fast way to get started with Discourse development. Their free tier is good for 30 hours per month of a 4-core machine. Getting Started Navigate to [the github repository](https://github.com/discourse/discourse) Press the , (comma) key on your keyboard, to open GitHub codespaces Use ‘change options’ to customize the machine. Technically, the 2-core machine will work, but we recommend using at least 4-core for a better experience. Click “Create Codespace” Wait for the contai…

I’m gonna add a note to the top of the OP here, directing people to the official guides ✍
