- Docker >= 18.06.0
- NodeJs >= 8.0.0
- npm >= 3.0.0
- Python >= 3.5
- pip3 >= 19.0.3
- docker-compose >= 1.22.0
- mysql >= 5.7.25
-
Install all dependencies by executing below command :
npm install
-
We will be using localstack to mimic SQS and S3 storage in local environment. Below command will setup localstack and redis into the docker.
docker-compose up -d
-
After this you have to install awscli in order to create S3 bucket and SQS queues. To install awscli run below command.
pip3 install awscli
-
We will create an S3 bucket and SQS queue in localstack. The
setup.sh
file will create the bucket and SQS queue that will be used in this demo but before we have to give permission to this file. Run below command to give permission.chmod +x setup.sh
-
After that run the script by this command,
./setup.sh
-
Rename
.env.example
to.env
and assign database name toDB_DATABASE
env variable. -
After that install adonis cli by below command,
npm i -g @adonisjs/cli
-
Run migration using below command,
adonis migration:run
-
Run below command to start the app,
adonis serve --dev
- This framework is very similar to laravel framework, we can create migration (https://adonisjs.com/docs/4.1/migrations), controller (https://adonisjs.com/docs/4.1/controllers) just like laravel.
- Configuration for MySql database is in
config/database.js
. - I have created the migration of two tables : Users and Todos, In Users table we will store users and in todo tables we will store todo note of each user.
- Relationships between to models can be defined also like laravel, see
app/models
. More on this is explained in here https://adonisjs.com/docs/4.1/relationships - There is a postmaster collection of endpoints to check S3, redis, SQS, Prometheus in AdonisJs. The descrition for each point is given in it. You have to import it to the postmaster.
- Support for the redis in AdonisJs is explained here https://adonisjs.com/docs/4.1/redis, Configuration file for redis can be changed from
config/redis.js
. - Support for S3 Storage in AdonisJs is explained here https://adonisjs.com/docs/4.1/file-system, Configuration file for S3 is located at
config/drive.js
. - Configuration for SQS is located in
config/aws.js
. - Prometheus data is generated by middlewares which are located in
app/Middleware
.