1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-28 06:00:06 +02:00

fix(joyent-cp-frontend): set REACT_APP_GQL_HOSTNAME

This commit is contained in:
Sérgio Ramos 2017-06-01 11:57:51 +01:00 committed by Judit Greskovits
parent 23871f351c
commit 539e1ea35e
4 changed files with 26 additions and 8 deletions

View File

@ -76,7 +76,7 @@ gql-mock-server:
image: quay.io/yldio/joyent-cp-gql-mock-server:$CIRCLE_BRANCH image: quay.io/yldio/joyent-cp-gql-mock-server:$CIRCLE_BRANCH
mem_limit: 512m mem_limit: 512m
labels: labels:
- triton.cns.services=gql-mock-server-$CIRCLE_BRANCH,cp-frontend-$CIRCLE_BRANCH - triton.cns.services=gql-mock-server-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*gql-mock-server*"] - com.docker.swarm.affinities=["container!=~*gql-mock-server*"]
environment: environment:
- CONSUL_AGENT=1 - CONSUL_AGENT=1

View File

@ -8,5 +8,9 @@ RUN npm install lerna@^2.0.0-rc.5 \
WORKDIR /home/node/app/packages/cp-frontend WORKDIR /home/node/app/packages/cp-frontend
COPY packages/cp-frontend/etc/containerpilot.json /etc/ COPY packages/cp-frontend/etc/containerpilot.json /etc/
ARG CIRCLE_BRANCH
ENV REACT_APP_GQL_HOSTNAME gql-mock-server-$CIRCLE_BRANCH.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone
EXPOSE 3069 EXPOSE 3069
CMD ["/bin/containerpilot", "yarn", "run", "start"] CMD ["/bin/containerpilot", "yarn", "run", "start"]

View File

@ -4,6 +4,9 @@ import { ApolloClient, createNetworkInterface } from 'react-apollo';
import state from './state'; import state from './state';
import { ui } from './reducers'; import { ui } from './reducers';
const GQL_HOSTNAME =
process.env.REACT_APP_GQL_HOSTNAME || window.location.hostname;
export const client = new ApolloClient({ export const client = new ApolloClient({
dataIdFromObject: o => { dataIdFromObject: o => {
const id = o.slug const id = o.slug
@ -18,7 +21,7 @@ export const client = new ApolloClient({
return `${o.__typename}:${id}`; return `${o.__typename}:${id}`;
}, },
networkInterface: createNetworkInterface({ networkInterface: createNetworkInterface({
uri: `http://${window.location.hostname}:3000/graphql` uri: `http://${GQL_HOSTNAME}:3000/graphql`
}) })
}); });

View File

@ -154,12 +154,23 @@ const deploy = async () => {
}); });
// up project // up project
return execa('docker-compose', ['up', '-d', '--build', '--force-recreate'], { return execa(
stdio: 'inherit', 'docker-compose',
env: Object.assign({}, env, { [
COMPOSE_PROJECT_NAME 'up',
}) '-d',
}); '--build',
'--force-recreate',
'--build-arg',
`CIRCLE_BRANCH=${process.env.CIRCLE_BRANCH}`
],
{
stdio: 'inherit',
env: Object.assign({}, env, {
COMPOSE_PROJECT_NAME
})
}
);
}; };
const run = async () => { const run = async () => {