You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+66-34
Original file line number
Diff line number
Diff line change
@@ -81,50 +81,82 @@ You can find sample `.env` files inside the `/docs` directory.
81
81
5. View table data in default environment: `npm run view-data <ModelName>`, ModelName can be `Challenge`, `ChallengeType`, `AuditLog`, `Phase`, `TimelineTemplate`or `Attachment`
82
82
6. Create Elasticsearch index: `npm run init-es`, or to re-create index: `npm run init-es force`
83
83
7. Synchronize ES data and DynamoDB data: `npm run sync-es`
84
+
8. Start all the depending services for local deployment: `npm run services:up`
85
+
9. Stop all the depending services for local deployment: `npm run services:down`
86
+
10. Check the logs of all the depending services for local deployment: `npm run services:logs`
87
+
11. Initialize the local environments: `npm run local:init`
88
+
12. Reset the local environments: `npm run local:reset`
89
+
84
90
85
91
### Notes
86
92
- The seed data are located in `src/scripts/seed`
87
93
88
94
## Local Deployment
95
+
0. Make sure to use Node v10+ by command `node -v`. We recommend using [NVM](https://github.com/nvm-sh/nvm) to quickly switch to the right version:
96
+
97
+
```bash
98
+
nvm use
99
+
```
100
+
101
+
1. 📦 Install npm dependencies
102
+
103
+
```bash
104
+
npm install
105
+
```
106
+
107
+
2. ⚙ Local config
108
+
In the `challenge-api` root directory create `.env` file with the next environment variables. Values for **Auth0 config** should be shared with you on the forum.<br>
109
+
```bash
110
+
# Auth0 config
111
+
AUTH0_URL=
112
+
AUTH0_PROXY_SERVER_URL=
113
+
AUTH0_AUDIENCE=
114
+
AUTH0_CLIENT_ID=
115
+
AUTH0_CLIENT_SECRET=
116
+
117
+
# Locally deployed services (via docker-compose)
118
+
IS_LOCAL_DB=true
119
+
DYNAMODB_URL=http://localhost:8000
120
+
```
121
+
122
+
- Values from this file would be automatically used by many `npm` commands.
123
+
- ⚠️ Never commit this file or its copy to the repository!
124
+
125
+
3. 🚢 Start docker-compose with services which are required to start Topcoder Challenges API locally
Go to https://console.aws.amazon.com/ and login. Choose S3 from Service folder and click `Create bucket`. Following the instruction to create S3 bucket.
136
+
5. ♻ Create tables.
92
137
93
-
### Local services setup
94
-
In the `local` folder, run `docker-compose up` to start Elasticsearch, DynamoDB, S3 compatible server and Mock API.
138
+
```bash
139
+
npm run create-tables
140
+
# Use `npm run drop-tables` to drop tables.
141
+
```
95
142
96
-
### Create Tables
97
-
1. Make sure DynamoDB are running as per instructions above.
98
-
2. Make sure you have configured all config parameters. Refer [Configuration](#configuration)
99
-
3. Run `npm run create-tables` to create tables.
143
+
6. ♻ Init DB, ES
100
144
101
-
### Mock API
102
-
The provided mock API provides mock endpoint to fetch challenge resources and groups so you don't have to deploy the related services locally.
103
-
You need to ensure DynamoDB configuration in `mock-api/config/default.js` is consistent with `config/default.js`
104
-
Mock API starts after running `docker-compose up` and expose port 4000.
145
+
```bash
146
+
npm run local:init
147
+
```
105
148
106
-
### Notes
107
-
There are two parts need to be updated for local development
0 commit comments