Add a button to a plugin with an added model

I’m working on a plugin that will be a front end for my Ansible Discourse management playbooks. Right now, this plugin is on its way to being a decent example of how to

  • add a model to Discourse
  • add some routes
  • create/modify stuff in the added model (this is where I"m stuck right now).

It should soon also have code that will allow it to be used as a github app. I might at some point feel the need to move the end result to a private repo, but I might not. I would like to provide sample code that adds a model and supports github actions (or app, I get them confused).

This makes a button show up!

this does not seem to make the button do anything :man_shrugging:

Adding a server model in rails

You can create a server with Pfaffmanager::Server.create(hostname: '")


@angus. I’ve set up a 8GB droplet. I added your ssh key from github.
I can’t get rails to bind to anything other than localhost, so I use port forwarding so that after you’ve connected localhost:3000 gets to rails on the remote server.

You should be able to connect with this SSH config:

    ssh -L 3000:localhost:3000  lc@

Or SSH config:

Host dev
IdentityFile ~/.ssh/id_rsa_lc
User lc
Port 22
LocalForward 3000
tmux attach

will get you into the tmux session that has rails running. ^Bd will disconnect you from tmux

I went back and forth about whether to forward local port 3000, and got burned when I thought I was talking to a local instance but was talking to the one on the remote server!

1 Like