提交 f7a8d06f 编写于 作者: A Alexandre Bodin 提交者: Alexandre BODIN

Add docker-compose.dev file to easily work with different databases in dev mode

Signed-off-by: NAlexandre Bodin <bodin.alex@gmail.com>

Remove old files not used anymore
Signed-off-by: NAlexandre Bodin <bodin.alex@gmail.com>

Added info about conflict with local db instances and how to change port configurations
Signed-off-by: NAlexandre Bodin <bodin.alex@gmail.com>

Fix typos
Signed-off-by: NAlexandre Bodin <bodin.alex@gmail.com>
上级 67187c38
......@@ -79,16 +79,9 @@ cd strapi && yarn setup
#### 4. Start the example application
**Go to the getstarted application**
Read the `getstarted` application README [here](./examples/getstarted/README.md).
```bash
cd strapi/examples/getstarted
yarn develop
```
The server (API) is available at http://localhost:1337
The built administration panel is available at http://localhost:1337/admin
#### 5. Running the administration panel in development mode
**Start the administration panel server for development**
......
MAKEFLAGS = -j1
export NODE_ENV = test
.PHONY: test
lint:
./node_modules/.bin/eslint **/*.js
test: lint
./scripts/test.sh
docs:
mkdocs build --clean
setup:
./scripts/setup.sh
version: '3'
services:
postgres:
image: postgres
restart: always
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_USER: strapi
POSTGRES_PASSWORD: strapi
POSTGRES_DB: strapi
ports:
- '5432:5432'
mongo:
image: mongo
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: strapi
volumes:
- mongodata:/data/db
ports:
- '27017:27017'
mysql:
image: mysql
restart: always
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_DATABASE: strapi
MYSQL_USER: strapi
MYSQL_PASSWORD: strapi
MYSQL_ROOT_HOST: '%'
MYSQL_ROOT_PASSWORD: strapi
volumes:
- mysqldata:/var/lib/mysql
ports:
- '3306:3306'
volumes:
pgdata:
mongodata:
mysqldata:
# getstarted
A quick description of getstarted.
This is an example app you can run to test your changes quickly.
Start the app with mongo
## Requirements
`DB=mongo yarn develop`
- 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](./config/environments/development/database.js)
**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/environments/development/database.js` and the `docker-compose.dev.yml` file.
**Example**:
`database.js`
```js
module.exports = {
connections: {
default: {
connector: 'mongoose',
settings: {
// host: 'localhost',
// database: 'strapi',
// username: 'root',
// password: 'strapi',
port: 27099,
},
options: {},
},
},
};
```
`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'
```
theme: "readthedocs"
docs_dir: ./website
site_dir: ./packages/strapi-generate-new/files/public
theme_dir: ./website/theme
site_name: "Strapi"
site_description: "Node.js framework powering API-driven web and mobile applications."
site_author: "Strapi"
site_url: "http://strapi.io/"
repo_name: "Strapi"
repo_url: "https://github.com/strapi/strapi"
markdown_extensions:
- admonition
- smarty
- sane_lists
- toc:
permalink: "#"
extra:
command: "$ npm install strapi-cli -g"
baseline: "Powering API-driven web and mobile applications."
start: "Get started"
current_version: "Current version"
version: "2.0.0"
pages:
- Home: ./index.md
- Prologue:
- Introduction: ./documentation/prologue/why.md
- Install Strapi: ./documentation/prologue/installation.md
- How it works: ./documentation/prologue/start.md
- Architecture foundations:
- Configuration: ./documentation/architecture/configuration.md
- Router: ./documentation/architecture/router.md
- Context: ./documentation/architecture/context.md
- Request: ./documentation/architecture/request.md
- Response: ./documentation/architecture/response.md
- Databases: ./documentation/architecture/databases.md
- Views: ./documentation/architecture/views.md
- Logging: ./documentation/architecture/logging.md
- Concepts:
- Authentication: ./documentation/concepts/authentication.md
- GraphQL: ./documentation/concepts/graphql.md
- JSON API: ./documentation/concepts/jsonapi.md
- WebSockets: ./documentation/concepts/websockets.md
- Internationalization: ./documentation/concepts/internationalization.md
- Scheduled tasks: ./documentation/concepts/cron.md
- Services: ./documentation/concepts/services.md
- Policies: ./documentation/concepts/policies.md
- Sessions: ./documentation/concepts/sessions.md
- SQL databases:
- Models: ./documentation/sql/models.md
- Migrations: ./documentation/sql/migrations.md
- Query builder: ./documentation/sql/queries.md
- Raw: ./documentation/sql/raw.md
- Interfaces: ./documentation/sql/interfaces.md
- SQL ORM: ./documentation/sql/orm.md
- Advanced usage:
- Security: ./documentation/advanced/security.md
- Lifecycle events: ./documentation/advanced/events.md
- Error handling: ./documentation/advanced/errors.md
- Custom generators: ./documentation/advanced/generators.md
- Custom hooks: ./documentation/advanced/hooks.md
- Legal Info:
- Governance: ./info/governance.md
- Code Of Conduct: ./info/conduct.md
- Releases: ./info/releases.md
- Security: ./info/security.md
- Trademarks: ./info/trademarks.md
- Licenses: ./info/licenses.md
- Support: ./info/support.md
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册