Comments (16)
@soedirgo just spoke to paul, the first step here is to actually just automate the building and releasing of the realtime app as a binary
so can forget about all the VM stuff and digital ocean for a moment (although this will probably be the next step)
What we need is that each time somebody tags a release, github builds the app for each environment (for starters just ubuntu and osx is fine), and creates a release with the binaries attached (for example: https://github.com/setvisible/DownZemAll/releases)
this can all be achieved with github actions: https://github.com/features/actions
If you want to start by forking this repo and experimenting on your own fork - then we can merge the actions back into this repo when you've got it up and running
this looks like a good template to get started: https://github.com/actions/create-release
you should start by just building the realtime app on your own OS to get a feel for what dependencies are required (mix etc.) and then here is an example of how the realtime app is built with ansible, so may be able to copy over some of the steps: https://github.com/supabase/kps/blob/master/ansible/tasks/setup-supabase.yml
from realtime.
Quick question - this part sticks out to me:
Build the Phoenix app through ansible (within the builder, not the final image)
Does this mean that you're building the phoenix application on the DO image? eg - installing elixir/mix etc, then running a build?
For this question:
Is realtime usually on the same machine as the DB?
No - this is a standalone server, so it will only run realtime
and connect to a separate database specified by env_vars
from realtime.
Just get the binary! Decrease the surface area. Probably better if we switch the docker to do the same - then we can use a slim image
from realtime.
@dragarcia might have some learnings here from the AWS and DO listing processes - I saw one thing which said make sure you don't use standardized defaults for secure seeds / passwords etc.
from realtime.
@kiwicopple this would be an Ubuntu image with just the realtime app installed - would you expose the realtime port directly? Or would we still want kong with single route? (thinking about apikeys/rate-limiting etc.)
from realtime.
also just for clarity, we only want to build the realtime server for now, so everything found within this folder: https://github.com/supabase/realtime/tree/master/server
from realtime.
@soedirgo this one is done now right? nothing remaining?
from realtime.
Still, working on 3 and 4, should be done today
from realtime.
all good! take your time and let me know if you get stuck
from realtime.
Ack, okay, this is more difficult than I thought. (And I should stop saying "today" or "this week")
What I've done:
- Build from a base image (only testing on DO for now)
- Let the user pass user variables for
DB_HOST
,DB_PASSWORD
,DB_PORT
, etc. to ansible - Build the Phoenix app through ansible (within the builder, not the final image)
- Connect to a database from
DB_HOST
(again, within the builder)
I'm using a supabase/postgres droplet for this, and can only say it "sorta works" because realtime said something along the lines of "no table named todos" when I connected to it from the next.js example.
Blockers:
- IIUC the realtime binary needs envars to work. How is this usually done? /etc/profile? Embed into a shell script?
- I need realtime to run on startup. Seems to do with systemd, and on a related note, kps and postgres seem to use systemd slices which I'm new to.
- Is realtime usually on the same machine as the DB? And if so, do we maybe want to build the image with a supabase/postgres base? (Probably for the next step)
from realtime.
Does this mean that you're building the phoenix application on the DO image? eg - installing elixir/mix etc, then running a build?
Yeah, I could just get a binary from the releases, but unsure if that's gonna cause incompatibility issues. (Was mostly copying how it's done with Docker)
from realtime.
hey @soedirgo this is a really good intro and cheatsheet to systemctl - the tool we use to manage systemd: https://www.linode.com/docs/quick-answers/linux-essentials/introduction-to-systemctl/
here is the realtime systemctl file from KPS: https://github.com/supabase/kps/blob/master/ansible/files/supabase.service.j2
on the question of env vars the above file also shows how you can specify which file to put the env vars in, so can be app specific
on how to pass them in at run/provisioning time we use cloud config
scroll down and find the write_files
directive, we basically just copy a string of the env vars into /etc/supabase.env
as per the .j2 file above
from realtime.
Gotcha, will grok into those!
On that note, what kind of hardening should I use? Just as a bare minimum. I know postgres uses UFW to block anything but 22 and 5432.
from realtime.
aye let me document a checklist for the marketplaces that we're in so far and share it here later on.
from realtime.
Hope this helps!
https://github.com/supabase/home/issues/17
from realtime.
Awesome, everything in one place. Thanks!
from realtime.
Related Issues (20)
- Realtime: Self Hosting - Docker Swarm mode HOT 6
- Docker-compose file appears to be broken HOT 40
- Unable to use null filters like 'parent IS NULL' in supabase realtime. HOT 3
- > Does supabase have null filters? HOT 1
- Self hosted : failed to connect: ** (Postgrex.Error) ssl not available HOT 1
- Startup error running migrations: table identifier does not refer to an existing ETS table HOT 8
- Erroneous public.test_tenant file from Supabase Realtime Migrations HOT 5
- Supabase Realtime Subscript Fails With Undefined Error (Possibly: `Auth error: tenant 'realtime-dev' not found` HOT 15
- supabase realtime not working HOT 26
- Seeds broken in latest docker image HOT 2
- horizontal scaling for self-hosted realtime servers, for broadcast and presence features HOT 5
- HTTP 431 & Realtime Subscriptions Failing HOT 11
- Realtime event broadcasting through REST calls does not work HOT 8
- Excessive logs being printed to STD OUT/ERR HOT 1
- [Broken] Custom primary keys (nanoids) breaks realtime listeners
- Supabase realtime in own database - error relation "tenants" does not exist HOT 1
- Running realtime in a cluster - Postgres changes not working reliably HOT 1
- Docker pull: "Retrying after 4s: public.ecr.aws/supabase/realtime:v2.25.50" HOT 1
- too_many_channels error: `"{:error, :too_many_channels}"` HOT 2
- Supabase Realtime Docker Image Breaking local development
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realtime.