# Developing with Discourse

**URL:** https://meta.discourse.org/t/developing-with-discourse/72777
**Category:** Development
**Created:** [October 25, 2017, 5:59pm UTC](https://meta.discourse.org/t/developing-with-discourse/72777 "2017-10-25T17:59:20Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![drew0101](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drew0101](https://meta.discourse.org/u/drew0101)
#### Post date: [October 25, 2017, 5:59pm UTC](https://meta.discourse.org/t/developing-with-discourse/72777/1 "2017-10-25T17:59:20Z")

</div>

Hello,

I am building an app that includes a full featured discussion board. Discourse has all the features required for the discussion board feature, so my plan is to use discourse as a starting point and to build features on top of it. I have followed guides to set up the official docker development environment locally and have added a couple features on top of it. I have also followed guides for the One Click Install of discourse on DigitalOcean. I am confused however, because in the process of deploying, I never connected the DigitalOcean instance to my repo. So my question is, how do connect my repo to the digital ocean instance so that I can begin deploying my new features?

I have read the following two links, but did not find an answer as I am not looking to just add plugins.

> [@Push to digital ocean from command line and rebuild](https://meta.discourse.org/t/push-to-digital-ocean-from-command-line-and-rebuild/61931):
>
> Hi ! I’ve followed the official install guide and I managed to have discourse working on digital ocean. However, I couldn’t find how to setup a regular deployment flow (I’m not very familiar with docker and digital ocean). I have discourse running locally (without docker), and running on digital ocean. How can I deploy my changes to the droplet ? Can I setup automatic deployment from github or can I simply deploy from the command line ? Do I need to rebuild discourse afterwards to see the cha…

> [@How to setup both development and production environment](https://meta.discourse.org/t/how-to-setup-both-development-and-production-environment/47040):
>
> Hi, I’m new to Discourse and Ruby, so forgive me for asking such simple question. But I have a production website with Docker running on my DigitalOcean server and a development version with Vagrant running on my Mac. Is this the proper setup? Or should I make both environments on my server? After tweaking and developing in the development environment, what’s the best practice to deploy everything I did to the server? Please help me with this or suggest me a tutorial if possible. Thank you so m…

I have also read this topic, but the poster is using an unsupported setup.  
[https://meta.discourse.org/t/how-to-customize-your-own-discourse-and-deploy-it-to-production-on-ubuntu-for-beginners/23475](https://meta.discourse.org/t/how-to-customize-your-own-discourse-and-deploy-it-to-production-on-ubuntu-for-beginners/23475)

What is the official supported way to set up a discourse instance that I can push my own features to?

Thank you!

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [October 25, 2017, 6:14pm UTC](https://meta.discourse.org/t/developing-with-discourse/72777/2 "2017-10-25T18:14:35Z")

</div>

> [@Push to digital ocean from command line and rebuild](https://meta.discourse.org/t/push-to-digital-ocean-from-command-line-and-rebuild/61931/4):
>
> Customizing Discourse core is not recommended. And official docker installation does not have easy way deploy it. To do modifications the best ways are [Admin side customizations](https://meta.discourse.org/t/better-documentation-of-tabs-in-admin-customize-css-html/49171/3)[Custom themes](https://meta.discourse.org/t/how-to-develop-custom-themes/60848)[Plugins](https://meta.discourse.org/t/beginners-guide-to-creating-discourse-plugins-part-1/30515) All these ways are easily maintainable and supporting docker.

In your case you must learn about how to develop Discourse plugins.

Edit: Using plugins you can make whatever changes you need in Discourse. Everything is possible with it.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 25, 2017, 6:48pm UTC](https://meta.discourse.org/t/developing-with-discourse/72777/3 "2017-10-25T18:48:35Z")

</div>

> [@drew0101](#):
>
> I have read the following two links, but did not find an answer as I am not looking to just add plugins.

Unless you have a team of several full-time programmers to integrate upstream changes into Discourse, and you desire never, **ever** to get **any** help, **whatsoever** , here, what you want to do is “just add plugins.”

You should find those topics about plugin development and ask questions when you get stuck.

Or, if you want to run your own fork of Discourse. Good luck!

---

<div class="post-metadata">

### Author: ![drew0101](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drew0101](https://meta.discourse.org/u/drew0101)
#### Post date: [October 25, 2017, 7:09pm UTC](https://meta.discourse.org/t/developing-with-discourse/72777/4 "2017-10-25T19:09:25Z")

</div>

Thanks guys. I have read through the guides for plugin development and I think that there is potential I can achieve my goals with plugin development. There are still a couple things that did not get answered from reading the guides, as the guides seems to focus more on adding UI elements and javascript.

1. How can I extend the existing models to fit my needs?
2. How can I add controller functions to add new features onto the discourse app?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 25, 2017, 7:11pm UTC](https://meta.discourse.org/t/developing-with-discourse/72777/5 "2017-10-25T19:11:32Z")

</div>

It’s probably best to take a step back and ask how to solve your particular problem rather than assume that you know the solution.

I am pretty sure that extending models is covered in those documents. A good way to get started is to find a plugin that does something like what you want and use it as an example.

---

<div class="post-metadata">

### Author: ![drew0101](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drew0101](https://meta.discourse.org/u/drew0101)
#### Post date: [October 25, 2017, 7:49pm UTC](https://meta.discourse.org/t/developing-with-discourse/72777/6 "2017-10-25T19:49:07Z")

</div>

I am sorry if it came off as me assuming I know the solution, as the opposite is most definitely the case. I am just very confused at this point. Forgive me if I am missing something, I read all 6 parts the following link for “Beginner’s Guide to Creating Discourse Plugins” and I don’t see anything about extending models or adding controller functions. Maybe an example would help clarify things.

Ex: I want to add proximity search so users can optionally set a location and find/meet up with people nearby them. This can be done with the following gem ([GitHub - diogob/activerecord-postgres-earthdistance: Search records with latitude and longitude within a radius · GitHub](https://github.com/diogob/activerecord-postgres-earthdistance))

My typical approach.

1. Add longitude and latitude attributes to the user model and migrate the db. (Lets assume all the users are seeded with a longitude and latitude)
2. Install gem and follow the gem’s documentation for setup.
3. Create a controller function that that takes three parameters (radius, longitude and latitude) and uses the parameters to query the postgres database (using the gem) and return users within the radius as json.
4. Create a component in ember that allows users to enter in longitude, latitude and radius and then query the controller function created in step 3.
5. Create a component that lists the results of the query in step 4.

From the guides I have read, I think I understand how to achieve steps 4 and 5, but not steps 1-3. The guides seem to be only dealing with javascript and not ruby code.

I hope this helps to clarify my questions. Thank you

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [October 26, 2017, 7:07am UTC](https://meta.discourse.org/t/developing-with-discourse/72777/7 "2017-10-26T07:07:52Z")

</div>

> [@drew0101](#):
>
> Add longitude and latitude attributes to the user model and migrate the db. (Lets assume all the users are seeded with a longitude and latitude)

While I cannot help you with the other questions (but I’m sure someone else can), I have a word of advice here: **Never** let the database scheme deviate from the one provided by Discourse, or you’ll be in pain as soon as Discourse updates start making updates to the scheme. ⛈

Instead, Discourse core has mechanisms for plugins to store data, for example the `plugin_store_rows` table: For each user, you could insert a row there, with a `key` containing their user id and `value` containing a JSON object with latitude and longitude, for example 🙂

---

<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: [August 21, 2018, 4:55pm UTC](https://meta.discourse.org/t/developing-with-discourse/72777/8 "2018-08-21T16:55:06Z")

</div>

@drew0101 consider adopting and contributing to [the Locations plugin](https://meta.discourse.org/t/locations-plugin/69742) instead of re-inventing the wheel 🙂
