
* Extract server config to a constant Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Omit options to server config Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Move default config to serverParams Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Simplify Apollo server config Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Simplify with a new apolloServerConfig property Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Update tracing documentation Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Extract deprecated options Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Add default options Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Update documentation Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Rename to deprecatedApolloServerConfig Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Empty default options Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Update default config Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Add warning note Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Add documentation note Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Update documentation note Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Fix the config check Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Fix the config check Signed-off-by: Abdón Rodríguez Davila <a@abdonrd.com> * Refactor old code and rename param to appoloServer to avoid redondancy Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com> * Fix typo Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com> Co-authored-by: Alexandre Bodin <bodin.alex@gmail.com>
getstarted
This is an example app you can run to test your changes quickly.
Requirements
- 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
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
Warning
You might have some errors while connecting to the databases.
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.
Example:
database.js
const mongo = {
connector: 'mongoose',
settings: {
database: 'strapi',
username: 'root',
password: 'strapi',
port: 27099,
host: 'localhost',
},
options: {},
};
// other connections...
module.exports = {
defaultConnection: 'default',
connections: {
default: mongo,
},
};
docker-compose.dev.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'