1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

Merge branch 'ci-config' into 'develop'

Gitlab CI config

See merge request !13
This commit is contained in:
Ricardo Hernandez 2017-06-02 17:19:57 +02:00
commit b57d0699e3
9 changed files with 83 additions and 23 deletions

View file

@ -1,4 +1,2 @@
node_modules/
nginx/
doc/
build/

53
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,53 @@
image: docker:17
variables:
GIT_SUBMODULE_STRATEGY: normal
DOCKER_COMPOSE_VERSION: 1.13.0
services:
- docker:dind
before_script:
- mkdir -p build
stages:
- build
- test
- deploy
build_job:
stage: build
script:
- docker run --rm -v $(pwd)/package.json:/usr/src/app/package.json -v $(pwd)/build:/usr/src/app/build -v $(pwd)/public:/usr/src/app/public -v $(pwd)/src:/usr/src/app/src -w /usr/src/app node:7.9.0-slim bash -c 'npm install; npm run build'
artifacts:
paths:
- build/
expire_in: 1 week
tags:
- docker
test_job:
stage: test
script:
- docker run --rm -e CI=true -v $(pwd)/package.json:/usr/src/app/package.json -v $(pwd)/public:/usr/src/app/public -v $(pwd)/src:/usr/src/app/src -w /usr/src/app node:7.9.0-slim bash -c 'npm install; npm test'
tags:
- docker
deploy_review:
stage: deploy
environment: review
script:
- mkdir -p ~/.docker
- echo "$DEPLOYMENT_CACERT" > ~/.docker/ca.pem
- echo "$DEPLOYMENT_CLIENT_CERT" > ~/.docker/cert.pem
- echo "$DEPLOYMENT_CLIENT_KEY" > ~/.docker/key.pem
- apk add --no-cache py-pip
- pip install docker-compose==$DOCKER_COMPOSE_VERSION
- docker-compose build
- export DOCKER_HOST=$DEPLOYMENT_HOST && export DOCKER_TLS_VERIFY=1 && export DOCKER_CERT_PATH=~/.docker && export COMPOSE_TLS_VERSION=TLSv1_2
- docker-compose --verbose down
- docker-compose --verbose up -d
only:
- develop
tags:
- docker

4
.gitmodules vendored Normal file
View file

@ -0,0 +1,4 @@
[submodule "VILLASweb-backend"]
path = VILLASweb-backend
url = ../../VILLASframework/VILLASweb-backend.git
branch = develop

1
VILLASweb-backend Submodule

@ -0,0 +1 @@
Subproject commit 8184b91f013f25887a129fd95354da3cc5796244

View file

@ -1,39 +1,33 @@
version: "2"
services:
webserver:
image: nginx:stable
volumes:
- ./nginx:/etc/nginx/conf.d/
- website-volume:/www
frontend:
build:
context: .
dockerfile: nginx/Dockerfile
links:
- backend
environment:
- REACT_APP_HTTP_PROXY
ports:
- "80:80"
- "443:443"
restart: always
frontend:
build: .
volumes:
- ./:/react
- website-volume:/result
backend:
image: villasweb-backend
build: VILLASweb-backend
links:
- database
environment:
- NODE_ENV=production
ports:
- "4000:4000"
restart: always
database:
image: mongo:latest
user: mongodb
volumes:
- data-volume:/data/db
- /opt/database:/data/db
restart: always
user: mongodb
volumes:
data-volume:
website-volume:

10
nginx/Dockerfile Normal file
View file

@ -0,0 +1,10 @@
FROM nginx:stable-alpine
# Copy frontend files and make them accesible to nginx
RUN mkdir /www
COPY build /www
RUN chown nginx:nginx -R /www
RUN chmod -R 0755 /www
# Copy nginx configuration
COPY nginx/villas.conf /etc/nginx/conf.d/default.conf

View file

@ -2,7 +2,6 @@
"name": "villasweb-frontend",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:4000",
"dependencies": {
"bootstrap": "^3.3.7",
"classnames": "^2.2.5",

View file

@ -1,8 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import Header from './components/header';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.render(<Header />, div);
});

View file

@ -22,7 +22,8 @@
import RestAPI from '../api/rest-api';
import AppDispatcher from '../app-dispatcher';
const API_URL = '/api/v1';
const HOST = process.env.REACT_APP_HTTP_PROXY || "";
const API_URL = HOST + '/api/v1';
class RestDataManager {
constructor(type, url, keyFilter) {