local docker config (dev) fixed
This commit is contained in:
parent
2a83d7e105
commit
c07e5c9608
@ -26,9 +26,9 @@ before_install:
|
|||||||
before_script:
|
before_script:
|
||||||
- export DATABASE_TEST_URL=postgres://postgres:@localhost:5432/mpwo_test
|
- export DATABASE_TEST_URL=postgres://postgres:@localhost:5432/mpwo_test
|
||||||
- export APP_SETTINGS=mpwo_api.config.TestingConfig
|
- export APP_SETTINGS=mpwo_api.config.TestingConfig
|
||||||
- export REACT_APP_USERS_SERVICE_URL=http://0.0.0.0:5000/api/
|
- export REACT_APP_API_URL=http://localhost:5000/api/
|
||||||
- export NODE_ENV=development
|
- export NODE_ENV=development
|
||||||
- export TEST_URL=http://0.0.0.0:3000
|
- export TEST_URL=http://localhost:3000
|
||||||
- export DISPLAY=:99.0
|
- export DISPLAY=:99.0
|
||||||
- sh -e /etc/init.d/xvfb start
|
- sh -e /etc/init.d/xvfb start
|
||||||
- sleep 3
|
- sleep 3
|
||||||
|
@ -13,9 +13,7 @@ services:
|
|||||||
|
|
||||||
api:
|
api:
|
||||||
container_name: api
|
container_name: api
|
||||||
build:
|
build: https://github.com/SamR1/mpwo.git#master:mpwo_api
|
||||||
context: https://github.com/SamR1/mpwo.git#master:mpwo_api
|
|
||||||
dockerfile: Dockerfile-ci
|
|
||||||
ports:
|
ports:
|
||||||
- 5001:5000
|
- 5001:5000
|
||||||
environment:
|
environment:
|
||||||
@ -33,10 +31,10 @@ services:
|
|||||||
container_name: client
|
container_name: client
|
||||||
build:
|
build:
|
||||||
context: https://github.com/SamR1/mpwo.git
|
context: https://github.com/SamR1/mpwo.git
|
||||||
dockerfile: ./mpwo_client/Dockerfile-ci
|
dockerfile: ./mpwo_client/Dockerfile
|
||||||
args:
|
args:
|
||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
- REACT_APP_USERS_SERVICE_URL=${REACT_APP_USERS_SERVICE_URL}
|
- REACT_APP_API_URL=${REACT_APP_API_URL}
|
||||||
ports:
|
ports:
|
||||||
- 3007:3000
|
- 3007:3000
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -2,42 +2,39 @@ version: '3.3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
db:
|
api-db:
|
||||||
container_name: db
|
container_name: api-db
|
||||||
build:
|
build: ./mpwo_api/db
|
||||||
context: ./mpwo_api/db
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
ports:
|
ports:
|
||||||
- 5435:5432
|
- 5435:5432
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=mpwo
|
- POSTGRES_USER=postgres
|
||||||
- POSTGRES_PASSWORD=mpwo
|
- POSTGRES_PASSWORD=postgres
|
||||||
|
|
||||||
api:
|
api:
|
||||||
container_name: api
|
container_name: api
|
||||||
build:
|
build: ./mpwo_api
|
||||||
context: ./mpwo_api
|
|
||||||
dockerfile: Dockerfile-dev
|
|
||||||
ports:
|
ports:
|
||||||
- 5001:5000
|
- 5001:5000
|
||||||
environment:
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:postgres@api-db:5432/mpwo
|
||||||
|
- DATABASE_TEST_URL=postgres://postgres:postgres@api-db:5432/mpwo_test
|
||||||
- FLASK_APP=server.py
|
- FLASK_APP=server.py
|
||||||
- FLASK_DEBUG=1
|
- FLASK_DEBUG=1
|
||||||
- APP_SETTINGS=mpwo_api.config.DevelopmentConfig
|
- APP_SETTINGS=mpwo_api.config.DevelopmentConfig
|
||||||
- DATABASE_URL=postgres://mpwo:mpwo@db:5432/mpwo
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- api-db
|
||||||
links:
|
links:
|
||||||
- db
|
- api-db
|
||||||
|
|
||||||
client:
|
client:
|
||||||
container_name: client
|
container_name: client
|
||||||
build:
|
build:
|
||||||
context: ./
|
context: ./
|
||||||
dockerfile: ./mpwo_client/Dockerfile-dev
|
dockerfile: ./mpwo_client/Dockerfile
|
||||||
args:
|
args:
|
||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
- REACT_APP_USERS_SERVICE_URL=${REACT_APP_USERS_SERVICE_URL}
|
- REACT_APP_API_URL=${REACT_APP_API_URL}
|
||||||
ports:
|
ports:
|
||||||
- 3007:3000
|
- 3007:3000
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
FROM python:3.6.3
|
|
||||||
|
|
||||||
# set working directory
|
|
||||||
RUN mkdir -p /usr/src/app
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
|
|
||||||
# add requirements
|
|
||||||
ADD ./requirements.txt /usr/src/app/mpwo_api/requirements.txt
|
|
||||||
|
|
||||||
# install requirements
|
|
||||||
RUN pip install -r mpwo_api/requirements.txt
|
|
||||||
|
|
||||||
# add app
|
|
||||||
ADD . /usr/src/app
|
|
||||||
|
|
||||||
# run server
|
|
||||||
CMD flask run --with-threads -h 0.0.0.0
|
|
@ -1,3 +1,3 @@
|
|||||||
FROM postgres
|
FROM postgres
|
||||||
|
|
||||||
ADD mpwo.sql /docker-entrypoint-initdb.d
|
ADD create.sql /docker-entrypoint-initdb.d
|
||||||
|
@ -5,21 +5,21 @@ RUN mkdir /usr/src/app
|
|||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
# add `/usr/src/app/node_modules/.bin` to $PATH
|
# add `/usr/src/app/node_modules/.bin` to $PATH
|
||||||
ENV PATH /app/node_modules/.bin:$PATH
|
ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
||||||
|
|
||||||
# add environment variables
|
# add environment variables
|
||||||
ARG REACT_APP_USERS_SERVICE_URL
|
ARG REACT_APP_API_URL
|
||||||
ARG NODE_ENV
|
ARG NODE_ENV
|
||||||
ENV NODE_ENV $NODE_ENV
|
ENV NODE_ENV $NODE_ENV
|
||||||
ENV REACT_APP_USERS_SERVICE_URL $REACT_APP_USERS_SERVICE_URL
|
ENV REACT_APP_API_URL $REACT_APP_API_URL
|
||||||
|
|
||||||
# install and cache app dependencies
|
# install and cache app dependencies
|
||||||
ADD package.json /usr/src/app/package.json
|
ADD package.json /usr/src/app/package.json
|
||||||
RUN npm install --silent
|
RUN yarn install --silent
|
||||||
RUN npm install react-scripts -g
|
RUN yarn global add react-scripts
|
||||||
|
|
||||||
# add app
|
# add app
|
||||||
ADD . /usr/src/app/
|
ADD . /usr/src/app/
|
||||||
|
|
||||||
# start app
|
# start app
|
||||||
CMD ["npm", "start"]
|
CMD yarn start
|
@ -1,25 +0,0 @@
|
|||||||
FROM node:latest
|
|
||||||
|
|
||||||
# set working directory
|
|
||||||
RUN mkdir /usr/src/app
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
|
|
||||||
# add `/usr/src/app/node_modules/.bin` to $PATH
|
|
||||||
ENV PATH /app/node_modules/.bin:$PATH
|
|
||||||
|
|
||||||
# add environment variables
|
|
||||||
ARG REACT_APP_USERS_SERVICE_URL
|
|
||||||
ARG NODE_ENV
|
|
||||||
ENV NODE_ENV $NODE_ENV
|
|
||||||
ENV REACT_APP_USERS_SERVICE_URL $REACT_APP_USERS_SERVICE_URL
|
|
||||||
|
|
||||||
# install and cache app dependencies
|
|
||||||
ADD package.json /usr/src/app/package.json
|
|
||||||
RUN npm install --silent
|
|
||||||
RUN npm install react-scripts -g
|
|
||||||
|
|
||||||
# add app
|
|
||||||
ADD . /usr/src/app/
|
|
||||||
|
|
||||||
# start app
|
|
||||||
CMD ["npm", "start"]
|
|
@ -1,35 +1,4 @@
|
|||||||
{
|
{
|
||||||
"name": "mpwo_client",
|
"name": "mpwo_client",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0"
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
|
||||||
"date-fns": "^1.29.0",
|
|
||||||
"history": "^4.7.2",
|
|
||||||
"react": "^16.2.0",
|
|
||||||
"react-dom": "^16.2.0",
|
|
||||||
"react-helmet": "^5.2.0",
|
|
||||||
"react-key-index": "^0.1.1",
|
|
||||||
"react-redux": "^5.0.6",
|
|
||||||
"react-router-dom": "^4.2.2",
|
|
||||||
"react-router-redux": "^5.0.0-alpha.9",
|
|
||||||
"react-scripts": "1.0.17",
|
|
||||||
"redux": "^3.7.2",
|
|
||||||
"redux-thunk": "^2.2.0"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"start": "cd mpwo_client && react-scripts start",
|
|
||||||
"build": "cd mpwo_client && react-scripts build",
|
|
||||||
"test": "cd mpwo_client && testcafe firefox e2e",
|
|
||||||
"eject": "cd mpwo_client && react-scripts eject",
|
|
||||||
"lint": "cd mpwo_client && eslint --cache --ext .jsx --ext .js src"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"babel-eslint": "^8.0.3",
|
|
||||||
"eslint": "^4.13.1",
|
|
||||||
"eslint-plugin-import": "^2.8.0",
|
|
||||||
"eslint-plugin-react": "^7.5.1",
|
|
||||||
"eslint-plugin-testcafe": "^0.2.1",
|
|
||||||
"randomstring": "^1.1.5",
|
|
||||||
"testcafe": "^0.18.6"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import keyIndex from 'react-key-index'
|
|
||||||
|
|
||||||
import mpwoApi from '../mpwoApi'
|
import mpwoApi from '../mpwoApi'
|
||||||
import { history } from '../index'
|
import { history } from '../index'
|
||||||
|
import { generateIds } from '../utils'
|
||||||
|
|
||||||
|
|
||||||
function AuthError(message) {
|
function AuthError(message) {
|
||||||
return { type: 'AUTH_ERROR', message }
|
return { type: 'AUTH_ERROR', message }
|
||||||
@ -138,7 +138,7 @@ export function handleUserFormSubmit(event, formType) {
|
|||||||
if (ret.length === 0) {
|
if (ret.length === 0) {
|
||||||
dispatch(register(formData.formData))
|
dispatch(register(formData.formData))
|
||||||
} else {
|
} else {
|
||||||
dispatch(AuthErrors(keyIndex(ret, 1)))
|
dispatch(AuthErrors(generateIds(ret)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
const apiUrl = `${process.env.REACT_APP_API_URL}`
|
const apiUrl = `${process.env.REACT_APP_API_URL}`
|
||||||
|
|
||||||
|
|
||||||
export default class MpwoApi {
|
export default class MpwoApi {
|
||||||
static login(email, password) {
|
static login(email, password) {
|
||||||
const request = new Request(`${apiUrl}auth/login`, {
|
const request = new Request(`${apiUrl}auth/login`, {
|
||||||
|
@ -1 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
export const isLoggedIn = () => !!window.localStorage.authToken
|
export const isLoggedIn = () => !!window.localStorage.authToken
|
||||||
|
|
||||||
|
export function generateIds(arr) {
|
||||||
|
let i = 0
|
||||||
|
let arrWithIds = arr.map(arr => {
|
||||||
|
const obj = { id: i, value: arr }
|
||||||
|
i++
|
||||||
|
return obj
|
||||||
|
})
|
||||||
|
return arrWithIds
|
||||||
|
}
|
||||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -2761,6 +2761,11 @@
|
|||||||
"cssom": "0.3.2"
|
"cssom": "0.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"cuid": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/cuid/-/cuid-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-dzz/KESlvSRPnAoThLqxHGfW94rtPYrHpQ8OpT5WwfJVlhysPw1U989+3fHrn/FdtuMrFW5dzOVR/CAb90RbNw=="
|
||||||
|
},
|
||||||
"currently-unhandled": {
|
"currently-unhandled": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"chalk": "2.3.0",
|
||||||
"date-fns": "^1.29.0",
|
"date-fns": "^1.29.0",
|
||||||
"history": "^4.7.2",
|
"history": "^4.7.2",
|
||||||
"react": "^16.2.0",
|
"react": "^16.2.0",
|
||||||
"react-dom": "^16.2.0",
|
"react-dom": "^16.2.0",
|
||||||
"react-helmet": "^5.2.0",
|
"react-helmet": "^5.2.0",
|
||||||
"react-key-index": "^0.1.1",
|
|
||||||
"react-redux": "^5.0.6",
|
"react-redux": "^5.0.6",
|
||||||
"react-router-dom": "^4.2.2",
|
"react-router-dom": "^4.2.2",
|
||||||
"react-router-redux": "^5.0.0-alpha.9",
|
"react-router-redux": "^5.0.0-alpha.9",
|
||||||
|
Loading…
Reference in New Issue
Block a user