2019-04-05 16:11:09 +02:00
# getstarted
2020-03-30 14:49:41 +02:00
This is an example app you can run to test your changes quickly.
2019-07-04 09:37:33 +02:00
2020-03-30 14:49:41 +02:00
## Requirements
2019-07-04 09:37:33 +02:00
2020-03-30 14:49:41 +02:00
- Docker
- Docker compose
- Node
## Installation
By default once you have setup the monorepo you will be able to run the getstarted app with a sqlite DB directly.
If you wish to run the getstarted app with another database you can use the `docker-compose.dev.yml` file at the root of the directory.
### start the databases
Run the following command at the root of the monorepo
```
docker-compose -f docker-compose.dev.yml up -d
```
If you need to stop the running databases you can stop them with the following command:
```
docker-compose -f docker-compose.dev.yml stop
```
### run the getstarted app with a specific database
```
DB={dbName} yarn develop
```
2020-05-29 05:54:47 -03:00
The way it works is that the `getstarted` app has a specific `database.js` config file that will use the `DB` environment variable to setup the right database connection. You can look at the code [here ](./config/database.js )
2020-03-30 14:49:41 +02:00
**Warning**
You might have some errors while connecting to the databases.
2020-05-29 05:54:47 -03:00
They might be coming from a conflict between a locally running database instance and the docker instance. To avoid the errors either shutdown your local database instance or change the ports in the `./config/database.js` and the `docker-compose.dev.yml` file.
2020-03-30 14:49:41 +02:00
**Example**:
`database.js`
```js
2020-05-29 05:54:47 -03:00
const mongo = {
connector: 'mongoose',
settings: {
database: 'strapi',
username: 'root',
password: 'strapi',
port: 27099,
host: 'localhost',
2020-03-30 14:49:41 +02:00
},
2020-05-29 05:54:47 -03:00
options: {},
2020-03-30 14:49:41 +02:00
};
2020-05-29 05:54:47 -03:00
2020-05-29 10:56:27 +02:00
// other connections...
module.exports = {
defaultConnection: 'default',
connections: {
default: mongo,
},
};
2020-03-30 14:49:41 +02:00
```
`docker-compose.dev.yml`
```yml
services:
mongo:
# image: mongo
# restart: always
# environment:
# MONGO_INITDB_ROOT_USERNAME: root
# MONGO_INITDB_ROOT_PASSWORD: strapi
# volumes:
# - mongodata:/data/db
ports:
- '27099:27017'
```