Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schüth committed Oct 10, 2019
0 parents commit 864400e
Show file tree
Hide file tree
Showing 232 changed files with 26,501 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/videos
node_modules
/uploads
/data
/keystore
/es

.project
.settings
.classpath

65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Gentics Mesh MuseTech Example

This repository contains all the sources that were needed to build the [musetech.getmesh.io](https://musetech.getmesh.io) demo site.

## Blogpost

This demo project is covered by two blogposts:

* Musetech: TODO LINK
* Technical: TODO LINK

## Project structure

This project consists of two parts. The __importer__ contains the *schema models*, *contents* and is responsible of importing the *images*, *videos*, *audioguides*, *exhibits*, *pages* into the headless CMS.
The __app__ contains the front-end react app which will present the content in various formats to clients.

### Importer

The importer is a Java program which will setup the project in Gentics Mesh.

The _ImportRunner.java_ class contains the main runner which can be executed to run the importer.

The importer is using the [Gentics Mesh Java Client](https://getmesh.io/docs/platforms/#_clients) and [RxJava](https://github.com/ReactiveX/RxJava) to create the project, schemas, microschemas and nodes.

### App

The React front-end uses [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) to access the Headless CMS API to fetch the contents via GraphQL. The URL for the Gentics Mesh instance that will be used can be configured in the `app/src/config.json` file.

The project can be build using `yarn && yarn build` or run via `yarn && yarn start`.

## Used software

* Backend: [Gentics Mesh - Headless CMS](https://getmesh.io)
* Frontend: [React](https://reactjs.org/), [Theme](https://blackrockdigital.github.io/startbootstrap-agency/)

## Contents

The contents that were used in this project have different licenses. The licenses have been added in the _json_ files. Please check the matching license before re-using the contents.

* Image: [Source List](importer/data/image/images.json)
* Video: [Source List](importer/data/video/videos.json)
* Text: All texts and descriptions are
* Audio: The audio guides that are part of this project have been generated using the text source.

## TODO

* links, license for texts
* Review rights

## Ideas

* Add fake ticket shop connection
* Add showcase video which highlights features of the demo (e.g. show screen usage)
* Add reminders
* Add tour information
* Add current event info
* Highlight exhibits in screen view
* Mark specific exhibits to be shown in the screen
* Add gallery support for exhibit views
* Add paging to exhibit list view
* Add dedicated TLD
* Add fake screen image frame to screen list view (to better grasp the concept of the screens)
* Add login and admin area to better divide the website features
* Add information about current delays
* Add draft/publish handling
47 changes: 47 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: "3"
services:

mesh:
image: gentics/mesh:0.40.3
environment:
- MESH_ELASTICSEARCH_URL=http://elasticsearch:9200
- MESH_ELASTICSEARCH_START_EMBEDDED=false
- MESH_AUTH_KEYSTORE_PASS=changeme
- MESH_GRAPH_DB_DIRECTORY=null
- MESH_MONITORING_ENABLED=false
ports:
- '8080:8080'
# volumes:
# - ./data:/graphdb
# - ./uploads:/uploads
# - ./keystore:/keystore
ulimits:
nofile:
soft: 20000
hard: 40000

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.6.2
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- '127.0.0.1:9200:9200'
# volumes:
# - ./es:/usr/share/elasticsearch/data
ulimits:
nofile:
soft: 65536
hard: 65536
memlock:
soft: -1
hard: -1

app:
build: ./frontend
image: musetech-frontend:latest
ports:
- '3010:80'


57 changes: 57 additions & 0 deletions esp/client/client.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WebSocketsClient.h>
#include <Hash.h>

ESP8266WiFiMulti WiFiMulti;
WebSocketsClient webSocket;

#define USE_SERIAL Serial1

const char* ssid = "Demo";
const char* password = "12345678";
const byte interruptPin = 13;
volatile byte interruptCounter = 0;
int numberOfInterrupts = 0;

void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);

Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}

Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());

webSocket.begin("138.201.65.159", 8080, "/api/v1/eventbus/websocket");
webSocket.setReconnectInterval(2000);

pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), handleInterrupt, RISING);
}

void handleInterrupt() {
interruptCounter++;
}

void loop() {
webSocket.loop();
if (interruptCounter > 0) {
Serial.println("Detected interrupt");
webSocket.sendTXT("{\"type\":\"publish\",\"address\":\"custom.event\",\"body\":\"someText\"}");
interruptCounter = 0;
}
delay(100);
webSocket.sendTXT("{\"type\":\"ping\"}");
String p = "Ping";
delay(100);
webSocket.sendPing(p);
}
1 change: 1 addition & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
3 changes: 3 additions & 0 deletions frontend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DANGEROUSLY_DISABLE_HOST_CHECK=true
HTTPS=false
PORT=3000
23 changes: 23 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

/.vscode
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
12 changes: 12 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:8-stretch as builder
RUN mkdir /app
ADD package.json /app
WORKDIR /app
RUN yarn install && yarn cache clean
ADD . /app
RUN yarn run build

FROM nginx
ADD nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/build /usr/share/nginx/html

44 changes: 44 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
17 changes: 17 additions & 0 deletions frontend/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

SHA1=$(git rev-parse HEAD)
REF=${SHA1:0:4}


PUSH_IMAGE=gtx-docker-apps.docker.apa-it.at/gentics/apps/musetech-app:$REF
PULL_IMAGE=docker.apa-it.at/gentics/apps/musetech-app:$REF
DEPLOYMENT=mesh-website-musetech-app

echo "Building image: $REF"

docker build -t $PUSH_IMAGE .
docker push $PUSH_IMAGE
kubectl -n core set image deployment/$DEPLOYMENT app=$PULL_IMAGE
kubectl -n core rollout status deployment/$DEPLOYMENT

44 changes: 44 additions & 0 deletions frontend/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
server {
listen 80;
server_name localhost;
index index.html;
root /usr/share/nginx/html;

# Proxying the API can be avoided when using CORS.
#location /api {
# proxy_pass http://mesh-website-musetech-mesh:8080/api;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "Upgrade";
#}

location / {
try_files $uri /index.html =404;
}

# Add no-cache for static contents
location ~* \.(?:html?|json)$ {
try_files $uri $uri/;
expires -1;
}

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires -1;
}

# CSS and Javascript
location ~* \.(?:css|js)$ {
#expires 1y;
expires -1;
access_log off;
add_header Cache-Control "public";
}

#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

}
46 changes: 46 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "mesh-musetech-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.22",
"@fortawesome/free-solid-svg-icons": "^5.10.2",
"@fortawesome/react-fontawesome": "^0.1.4",
"bootstrap": "^4.3.1",
"dompurify": "^1.0.11",
"lorem-ipsum": "^2.0.3",
"react": "^16.7.0-alpha.0",
"react-bootstrap": "^1.0.0-beta.12",
"react-cookie-consent": "^2.5.0",
"react-dom": "^16.7.0-alpha.0",
"react-ga": "^2.6.0",
"react-hook-shared-state": "^0.0.2",
"react-router-bootstrap": "^0.25.0",
"react-router-dom": "^5.0.1",
"react-scripts": "3.1.1",
"react-slick": "^0.25.2",
"slick-carousel": "^1.8.1",
"vertx3-eventbus-client": "^3.5.4"
},
"license": "MIT",
"scripts": {
"start": "react-scripts start",
"clean-cra-sw": "rm -f build/precache-manifest.*.js && rm -f build/service-worker.js",
"build-sw": "node ./src/sw-build.js",
"build": "react-scripts build && yarn build-sw && yarn clean-cra-sw",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"workbox-build": "^4.3.1"
}
}
Binary file added frontend/public/favicon.ico
Binary file not shown.
Loading

0 comments on commit 864400e

Please sign in to comment.