Skip to content

Deploying EdgeOS to self hosted cloud

Winston Tan edited this page Jun 19, 2023 · 3 revisions

Following up from the page: Building EdgeOS for cloud and edge, you are ready to put the built binaries up to your cloud server to host EdgeOS.

compress and upload

You can find the edge_os_cloud folder under edge-os/cloud/_build/prod/rel after your build following the instructions. All the executables are in it. It's time to zip them up and upload to your cloud server. I usually use the following command to zip up:

tar cvfJ edge_os_cloud.tar.xz edge_os_cloud

After it, I would use scp to upload edge_os_cloud.tar.xz up to cloud server. Something like the following line assuming that you also want to execute EdgeOS from /opt/edgeos.

scp edge_os_cloud.tar.xz [email protected]:/opt/edgeos

configure the ENV variables and run it

In your cloud server, you can unzip it with tar -xf edge_os_cloud.tar.xz. Your executable folder will then be under: /opt/edgeos/edge_os_cloud.

I use the following script to run the server:

#!/bin/bash
set -e

export PHX_SERVER=true
export DATABASE_URL=ecto://edgeos:some.url.to.db:db_port/edgeos
export SECRET_KEY_BASE=your_secret_key_base
export PHX_HOST=your.edgeos.host.name
export PHX_PORT=443
export REDIS_URI=redis://full.redis.path.to.your.redis/0
export GITHUB_CLIENT_ID=github oauth client id
export GITHUB_CLIENT_SECRET=github oauth client secret
export GOOGLE_CLIENT_ID=google oauth client id
export GOOGLE_CLIENT_SECRET=google oauth client secret
export SSL_KEY_PATH=/opt/edgeos/certs/your.ssl.cert.key
export SSL_CERT_PATH=/opt/edgeos/certs/your.ssl.cert.cert

# migrate db
/opt/edgeos/edge_os_cloud/bin/migrate

# run server
/opt/edgeos/edge_os_cloud/bin/edge_os_cloud start

A bit more explanation if you need it

As you can see, all you need to do is to figure out the env vars above and make sure that you have them configured when you execute both the EdgeOS DB migration script and server execution script.

/opt/edgeos/edge_os_cloud/bin/migrate line above conducts the DB migration shall there be any update on the DB schema. In case you are still guessing, EdgeOS is built with PostgreSQL.

/opt/edgeos/edge_os_cloud/bin/edge_os_cloud start line starts the long running server to host and bridge the connections.

Please feel free to update the scripts above and integrate them into your systemd config, or any other way you prefer to deploy EdgeOS.