Opla.ai Backend using Node es7 react and redux.
First of all, make sure you have Node 8.x and Yarn installed.
You will also need MariaDB 10.2 or mysql 5.7. We provide a Docker Compose configuration to get you started quickly.
-
Install the (dev) dependencies:
$ yarn install
-
Run the configuration tool:
$ bin/opla init
Important: if you want to use Docker Compose, accept all the default settings and run
docker-compose up -d
, otherwise configure your MariaDB instance. -
Run the migrations:
$ bin/opla migrations up
-
Start the dev environment:
$ yarn dev
This application should be available at: http://127.0.0.1:8081/.
We use db-migrate to manage the
database migrations with a specific configuration for this project. By using the
bin/opla
tool, this configuration is automatically generated and db-migrate
is bound to the bin/opla migrations
command. Do not run db-migrate
directly
(it should complain about not finding the configuration file anyway).
-
Run:
$ bin/opla migrations create "short explanation of the migration"
The
"short explanation of the migration"
will be used in the migration filename (see the content of themigrations/
folder for some examples). Choose something short and self-explanatory.This command will create several files, all of them should be put into Git. You should not have to care about the generated JavaScript files as writing migrations in plain SQL is much easier. In addition, you should not deal with the
down
migrations, since database rollbacks never work in practice, we only go forward. -
Write your migration in plain SQL in the generated file:
echo "<SQL STATEMENT>;" > migrations/sqls/20180307110023-short-explanation-of-the-migration-up.sql
Then, you can apply this migration and make sure everything works as intended.
To apply all migrations at once, run:
$ bin/opla migrations up
Please, see the CONTRIBUTING file.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See CODE_OF_CONDUCT file.
You have 2 options:
- pass ENV variables to override config properties one by one. See Dockerfile ENV
statement for available environment variables.
- override default.json
by mounting your own /src/config/config.json
file. You can create such a file by running bin/opla init
locally.
opla-front is released under the GPL v2.0+ License. See the bundled LICENSE file for details.