# (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:** 1\
**Showing post:** 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! 🎉

---

_[View the full topic](https://meta.discourse.org/t/outdated-guide-to-setting-up-discourse-development-environment-github-codespace/307231)._
