Warning, none of the branches are currently stable. The code is not guaranteed to work, and the database schemas sometimes are updated without creating new migration files. Currently, this is a work-in-progress.
The core powering Polygon: an upcoming open-source & privacy-oriented social network that is not hungry for your data.
Warning: this guide is not created for production purposes. Using this as a way to self-host Polygon is not recommended and may cause errors in the long-term.
These steps will guide you through the process of setting up a polygon-isecure/core instance on your machine for development purposes.
For that you will need:
- Yarn installed.
- Node.js runtime installed. Version
14.17.6is recommended. - Docker installed. Will be used for provisioning Redis, Stormi and PostgreSQL databases.
Polygon's core depends on Redis and PostgreSQL. Let's setup a Redis instance using the following Docker command:
docker run --name redis -dp 6379:6379 redis redis-server --requirepass "<password>"and replace the <password> with a secure password. You redis connection URL should now look something like this:
redis://default:<password>@localhost:6379/Now let's setup PostgreSQL. From the terminal, execute the following command:
docker run --name postgres -dp 5432:5432 -e POSTGRES_PASSWORD=<password> postgresand replace the <password> with a secure password. After doing these steps your PostgreSQL connection URL should look like this:
postgres://postgres:<password>@localhost:5432/postgresFinally, let's configure Stormi, which is a simple, hash-based and open-source file server.
docker run --name stormi -dp 6345:6345 ghcr.io/polygon-isecure/stormi:masterBy default, the username and password are admin
and stormi-admin.
Stormi connection string has the following structure:
https://admin:stormi-admin@localhost:6345/After the databases have been provisioned, we will need to configure the core.
Create a config.yaml in root directory and add the following properties to it:
jwt:
secret: "<something super random>"
databases:
redis: "redis://default:<password>@localhost:6379/"
stormi: "https://admin:stormi-admin@localhost:6345/"
postgres: "postgres://postgres:<password>@localhost:5432/postgres"Replace <something super random> with a random string. We recommend a string value
with a length of at least 512 bits(64 characters).
To sync the migrations with the database, run the following command:
yarn migrate "user=postgres password=<password> sslmode=disable dbname=postgres" upand replace <password> with the password that you defined
earlier for PostgreSQL. This will ensure that everything
related to SQL is up-to-date.
To install the dependencies, transpile the project and run it:
yarn install
yarn build
yarn startBy default, the server will start at http://localhost:3001/. To set a
custom port, you can specify the polygon.port variable in your configuration
file:
polygon:
port: 5000
# ...You should now have a complete version of polygon-isecure/core running. To sync with the nightly branch just run the following commands:
git fetch
git pull origin nightlyAgain, this guide is not intended for production purposes. Current version of
coreis unstable and has some problems that we still have to deal with.