Skip to main content

Manual Installation

First of all, many thanks for thinking about contributing. Please, read this document carefully for starting with your contribution.

Prerequisites

Before you begin, make sure you have the following tools installed:

ToolMinimum VersionDescription
PHP8.3 or higherPHP interpreter
Composer2.8 or higherDependency manager for PHP
Symfony CLI5 or higherOfficial Symfony command-line tool. User for starting the local webserver
Node.js22 or higherFor managing frontend assets and build tools
Git2.4 or higherVersion control
Docker28 or higherTo start the PostgreSQL database

Project Setup

Follow these steps to clone the repository, configure your environment, and run the application locally.

1. Clone the repository

git clone https://github.com/icolomina/equillar.git
cd equillar

2. Install PHP dependencies

composer install

3. Configure environment

cp .env.dist .env
cp .env.test.dist .env.test

The .env.dist file comes with a default password for the local database. After moving the dist files to your enviroment files, if you want to change the local database password, edit the .env file and modify the POSTGRES_USER and POSTGRES_PASSWORD with the values of your choice.

After doing it, change the "DATABASE_URL" enviroment var in the ".env" file by this one:

DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@127.0.0.1:5497/equillar?serverVersion=16&charset=utf8"

If you want to use a diferent port, just edit the "docker-compose.yaml" file and link another port on the database service.

4. Generate secrets

This application uses Symfony Vaults to keep and mantain some environment variables as secrets. To generate it follow the next steps:

4.1 Generate the encryption keys

php bin/console secrets:generate-keys

4.2 Generate three random secure values and set them as Symfony secrets

CRYPT_KEY=$(php -r 'echo bin2hex(sodium_crypto_secretbox_keygen());')
SECURITY_TOKEN_KEY=$(openssl rand -hex 32)
URI_SIGNER_KEY=$(openssl rand -hex 32)

echo -n "$CRYPT_KEY" | php bin/console secrets:set CRYPT_KEY -
echo -n "$SECURITY_TOKEN_KEY" | php bin/console secrets:set SECURITY_TOKEN_KEY -
echo -n "$URI_SIGNER_KEY" | php bin/console secrets:set URI_SIGNER_KEY -

5. Create the database schema and load fixtures

First of all you have to start the database. The database configuration is defined in the docker-compose.yaml file so to start the database you only have to execute the following commands:

docker create network soroban-equillar
docker compose up -d database

And now you are ready to set up the database schema and execute fixtures.


php bin/console cache:clear
php bin/console doctrine:schema:create
php bin/console doctrine:fixtures:load

You do not need to execute migrations if you are going to work in a local environment but, if you create a new entity or add some property to an existing one, please generate the corresponding migration using the following command:

php bin/console doctrine:migrations:diff 

After loading the database, you have to generate an Stellar address so that the platform can deploy the contracts to the blockchain and call their functions later. To do that, execute the following commands:

php bin/console app:generate-system-wallet --blockchain="stellar" --network="testnet"
php bin/console app:system-address:create-token-trustline --token=USDC
php bin/console app:system-address:create-token-trustline --token=EURC
php bin/console app:contract:deploy --vers="1.0" --status=STABLE --comments="Local contract version"

If you get an this error: "invalid type for accountid : 4717", simply try to run the command again.

Let's explain the commands line by line:

  1. Generate the Stellar Address by which the backend will interact wit Soroban.
  2. Creates a trustline within the System Address and the USDC Stellar Asset.
  3. Creates a trustline within the System Address and the EURC Stellar Asset.
  4. Install the contract code in the Stellar testnet and providers a Wasm ID which will be used to deploy the contracts by the app.

6. Execute PhpStan and tests

vendor/bin/phpstan analyse -l 5 src
vendor/bin/phpunit

7. Generate frontend

npm install
npm run watch

"npm run watch" rebuild the assets after every change in the frontend. If you do not need this feature, execute "npm run dev" instead.

8. Start the development server

symfony server:start --no-tls

The application will be available at http://127.0.0.1:8000 by default.