I’m quite new to Elixir, and am at a stage where I hope to handle more programming as opposed to merely using (PHP) CMSes and doing HTML and CSS. I have the start of a Phoenix project underway and was hoping to get some advice on structure, etc.
One aspect of the project is an API for the client’s Windows software to use to store some simple types of data and to submit support requests. It’s my client’s customers that will be using the Windows program, and I’m thinking that this particular service should be its own app and hosted on its own server, in order to minimise the chances of disruption to it due to work/maintenance/updates on the other, more complicated, parts/apps of the project or their server(s). I’ll refer to this app as the Workstation app.
I used Phoenix 1.3 to set up an umbrella app, and so far I have the support request- and attachment-storing of the Workstation app (with its lib/web directory) working and deployed. The Windows software uses HTTP over TLS with HTTP Basic Auth to POST support request details and attachments; the textual details are stored in a PostgreSQL database on the app server and the attachments are stored as files on the app server’s filesystem.
My plan is to provide for support request management (reading, viewing/downloading attachments, replying, marking as solved, etc.) by my client, and administration of other aspects of the project (website content, customer system data, etc.), as part of another app run on a different server. This would be called the Admin app.
I’m thinking that the Workstation app’s data would effectively be read-only from the Admin app’s point of view, and that the Admin app will keep its own copy of all the API-submitted data in its own database/filesystem, with the addition of support request properties such as status (closed, open) and replies, and that the Admin app would handle email notifications.
Is this approach to separation sound in general?
If so, regarding how the data from the Workstation app will get to the Admin app, I’d be grateful for guidance.
The two apps’ servers could be in the same data centre and thus be able to be on the same private/private-ish network, but perhaps this should not be a requirement. If I allow for them to be in different data centres for greater flexibility/less coupling(?), could/should I:
- extend the HTTP API of the Workstation app so that the Admin app can periodically (e.g., every fifteen minutes) check for new issues;
- (additionally or instead?) use Phoenix channels to have the Workstation app “push” new support requests to the Admin app (assuming channels can go from server to server)?
(For the attachments, I was thinking I could simply rsync over SSH.)
Or are there better options? Should I have both servers in the same data centre so that they can be nodes that talk to each other? Would using GenServer be a good way of transferring data from the Workstation app to the Admin app whenever the Admin app is available?
I’ve purchased and am part way through some Elixir/Phoenix learning resources but I’m planning to start Elixir for Programmers soon. I see that it includes sections on processes, agents, supervisors, OTP and nodes. I’ve been reading posts here and looking at documentation on such topics but I haven’t yet had any experience of using them so I’m still vague.