108 lines
4.1 KiB
Text
108 lines
4.1 KiB
Text
HOW TO HOST UR OWN LYPHE INSTANCE!! :D
|
|
niko vcs - real microsoft llc founder
|
|
|
|
asklyphe is structured in a way that should hopefully promote easy scaling
|
|
in the future, i.e. we can easily add more machines or better hardware to
|
|
our pre-existing machines and lyphe just becomes faster without any changes
|
|
to code.
|
|
|
|
because of this, we're using a stateless microservice architecture. that means
|
|
that core functionality is split into "services" which all do one kind of
|
|
task.
|
|
|
|
authservice handles authentication (and also anything that touches the postgres
|
|
database, might be changed in the future)
|
|
|
|
searchservice handles requests for searches, then compiles the results from the
|
|
search database and returns them.
|
|
|
|
etc.
|
|
|
|
the "stateless" part means that ideally, any service can be restarted and act
|
|
the exact same as if it were running continuously.
|
|
we don't store state in memory, and everything goes in databases.
|
|
|
|
all of this is to say that there's a reason that the architecture may at first
|
|
look a little complicated.
|
|
|
|
== MINIMUM VIABLE SETUP ==
|
|
this setup will get you an asklyphe setup that you can log into. you won't be
|
|
able to search for anything, but the website will generally start up and show
|
|
stuff.
|
|
|
|
you'll need:
|
|
- rust compiler
|
|
- nats-server binary (https://nats.io/)
|
|
- postgres server
|
|
- caddy (https://caddyserver.com/)
|
|
(alternatively, some other webserver with reverse-proxy + static file hosting
|
|
and willingness to convert our caddyfiles)
|
|
|
|
and the asklyphe services:
|
|
- authservice
|
|
(https://forge.voremicrocomputers.com/asklyphe-public/authservice)
|
|
- asklyphe-frontend
|
|
(https://forge.voremicrocomputers.com/asklyphe-public/asklyphe-frontend)
|
|
- asklyphe-auth-frontend
|
|
(https://forge.voremicrocomputers.com/asklyphe-public/asklyphe-auth-frontend)
|
|
|
|
first, compile all the asklyphe services. should be as simple as running
|
|
`cargo build --release` (or without the --release flag if you want to debug)
|
|
|
|
secondly, you'll want to start up your postgres server and run the migrations
|
|
go to authservice/migration and run `cargo run -- up -u <postgres url>`
|
|
e.g. `cargo run -- up -u postgres://postgres:postgres@127.0.0.1/postgres`
|
|
|
|
thirdly, you'll want to start the nats server. just go to the directory
|
|
where you put nats-server and run `./nats-server -js`
|
|
|
|
finally, you can run each of the asklyphe service binaries you built.
|
|
they'll all need to have the following environment variables set:
|
|
|
|
RUST_LOG=<log level> (something like info or debug is good, this is optional)
|
|
NATS_URL="127.0.0.1:4222" (or whereever your nats server is)
|
|
NATS_KEY=<path to a pem keyfile> (used for nats tls, see below)
|
|
NATS_CERT=<path to a pem cert> (used for nats tls, see below)
|
|
|
|
KEY AND CERT ARE REQUIRED!!! however, you can use a dummy key and cert if you
|
|
don't feel like setting up tls on nats.
|
|
|
|
certain services need extra environment variables:
|
|
|
|
-- authservice --
|
|
DB_URL=<same postgres url as before>
|
|
SMTP_DISABLE=1 (or, see below)
|
|
SMTP_URL=<smtp url> (server must support starttls)
|
|
SMTP_USERNAME=<smtp username>
|
|
SMTP_PASSWORD=<smtp password>
|
|
|
|
-- asklyphe-auth-frontend --
|
|
ASKLYPHE_URL="http://127.0.0.1:8002" (alternatively, whatever url your instance
|
|
is on)
|
|
|
|
-- asklyphe-frontend --
|
|
AUTH_URL="http://127.0.0.1:8001" (alternatively, whatever url your
|
|
auth-frontend is on)
|
|
|
|
finally, you can run caddy with the caddyfile provided in the
|
|
asklyphe-auth-frontend git tree, and run all the services
|
|
|
|
you *hopefully* *should* be able to connect to https://127.0.0.1:8002 and see
|
|
the asklyphe homepage! insert an invite code into the database and you can
|
|
create an account!
|
|
|
|
== ADDING SOME SEARCH SERVICES ==
|
|
|
|
bingservice and googleservice should be fine by just compiling and running
|
|
without anything other than the NATS_* environment variables, however
|
|
running searchservice will take a bit more work
|
|
|
|
searchservice requires a foundationdb instance be running, specifically version
|
|
7.1.3 (will be changed in the future once we move to our own database system)
|
|
|
|
once you follow the setup instructions at https://www.foundationdb.org/ you
|
|
should be good to go (foundationdb uses a file in /etc to authenticate,
|
|
no envvars needed)
|
|
|
|
that should be all that's needed! there's probably stuff i'm forgetting so i'll
|
|
update this file as needed
|