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:
| Tool | Minimum Version | Description |
|---|---|---|
| PHP | 8.3 or higher | PHP interpreter |
| Composer | 2.8 or higher | Dependency manager for PHP |
| Symfony CLI | 5 or higher | Official Symfony command-line tool. User for starting the local webserver |
| Node.js | 22 or higher | For managing frontend assets and build tools |
| Git | 2.4 or higher | Version control |
| Docker | 28 or higher | To 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:
- Generate the Stellar Address by which the backend will interact wit Soroban.
- Creates a trustline within the System Address and the USDC Stellar Asset.
- Creates a trustline within the System Address and the EURC Stellar Asset.
- 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.