Browse Source

Fix for easy local run

develop
Apostolos Fanakis 5 years ago
parent
commit
6e8bf5a38b
  1. 2
      .dockerignore
  2. 3
      Dockerfile
  3. 2
      app/package.json
  4. 5
      app/src/config/ipfsOptions.js
  5. 28
      docker-compose.yml
  6. 16
      env/apella.env.example
  7. 6
      truffle-config.js

2
.dockerignore

@ -1,5 +1,7 @@
env/ env/
node_modules/ node_modules/
package-lock.json package-lock.json
yarn.lock
app/node_modules/ app/node_modules/
app/package-lock.json app/package-lock.json
app/yarn.lock

3
Dockerfile

@ -4,9 +4,6 @@ LABEL maintainer="apotwohd@gmail.com"
ENV DOCKER true ENV DOCKER true
# Installs a couple (dozen) more tools like python, c++, make and others
RUN apk --no-cache add build-base
# Installs a couple (dozen) more tools like python, c++, make and others # Installs a couple (dozen) more tools like python, c++, make and others
RUN apk --no-cache add build-base \ RUN apk --no-cache add build-base \
python3 && \ python3 && \

2
app/package.json

@ -38,7 +38,7 @@
"libp2p-websocket-star-rendezvous": "0.3.0" "libp2p-websocket-star-rendezvous": "0.3.0"
}, },
"scripts": { "scripts": {
"start": "HOST=${APELLA_HOST} react-scripts start", "start": "react-scripts start",
"rendezvous": "rendezvous --port=9090 --host=83.212.109.171", "rendezvous": "rendezvous --port=9090 --host=83.212.109.171",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "test": "react-scripts test",

5
app/src/config/ipfsOptions.js

@ -1,3 +1,6 @@
const REACT_APP_RENDEZVOUS_HOST = process.env.REACT_APP_RENDEZVOUS_HOST || '127.0.0.1';
const REACT_APP_RENDEZVOUS_PORT = process.env.REACT_APP_RENDEZVOUS_PORT || '9090';
// OrbitDB uses Pubsub which is an experimental feature // OrbitDB uses Pubsub which is an experimental feature
// and need to be turned on manually. // and need to be turned on manually.
const ipfsOptions = { const ipfsOptions = {
@ -10,7 +13,7 @@ const ipfsOptions = {
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star', '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
// Use local signaling server (see also rendezvous script in package.json) // Use local signaling server (see also rendezvous script in package.json)
// For more information: https://github.com/libp2p/js-libp2p-websocket-star-rendezvous // For more information: https://github.com/libp2p/js-libp2p-websocket-star-rendezvous
'/dns4/' + process.env.REACT_APP_RENDEZVOUS_HOST + '/tcp/' + process.env.REACT_APP_RENDEZVOUS_PORT + '/ws/p2p-websocket-star', '/dns4/' + REACT_APP_RENDEZVOUS_HOST + '/tcp/' + REACT_APP_RENDEZVOUS_PORT + '/ws/p2p-websocket-star',
] ]
} }
}, },

28
docker-compose.yml

@ -30,8 +30,6 @@ services:
- ./env/apella.env - ./env/apella.env
networks: networks:
- apella-net - apella-net
volumes:
- ./volumes/node_modules:/usr/apella/node_modules
expose: expose:
- "3000" - "3000"
@ -57,11 +55,11 @@ services:
- "443:443" - "443:443"
volumes: volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro - /var/run/docker.sock:/tmp/docker.sock:ro
- ./volumes/nginx/conf:/etc/nginx/conf.d - conf:/etc/nginx/conf.d
- ./volumes/nginx/vhost:/etc/nginx/vhost.d - vhost:/etc/nginx/vhost.d
- ./volumes/nginx/html:/usr/share/nginx/html - html:/usr/share/nginx/html
- ./volumes/nginx/dhparam:/etc/nginx/dhparam - dhparam:/etc/nginx/dhparam
- ./volumes/nginx/certs:/etc/nginx/certs:ro - certs:/etc/nginx/certs:ro
# Letsencrypt automated creation, renewal and use of Let's Encrypt certificates # Letsencrypt automated creation, renewal and use of Let's Encrypt certificates
# Reference: # Reference:
@ -79,14 +77,20 @@ services:
networks: networks:
- apella-net - apella-net
volumes: volumes:
- ./volumes/nginx/conf:/etc/nginx/conf.d - conf:/etc/nginx/conf.d
- ./volumes/nginx/vhost:/etc/nginx/vhost.d - vhost:/etc/nginx/vhost.d
- ./volumes/nginx/html:/usr/share/nginx/html - html:/usr/share/nginx/html
- ./volumes/nginx/dhparam:/etc/nginx/dhparam - dhparam:/etc/nginx/dhparam
- ./volumes/nginx/certs:/etc/nginx/certs:rw - certs:/etc/nginx/certs:rw
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
# Networks in use # Networks in use
networks: networks:
apella-net: apella-net:
driver: bridge driver: bridge
volumes:
conf:
vhost:
html:
dhparam:
certs:

16
env/apella.env.example

@ -1,19 +1,23 @@
# Docker compose variables # Docker compose variables
VIRTUAL_HOST=apella.tk VIRTUAL_HOST=example.com
VIRTUAL_PORT=3000 VIRTUAL_PORT=3000
# If you uncomment the lines below, Apella will become available through https BUT the rendezvous # If you uncomment the lines below, Apella will become available through https BUT the rendezvous
# server will stop working and IPFS initialization won't complete # server will stop working and IPFS initialization won't complete
#LETSENCRYPT_HOST=apella.tk #LETSENCRYPT_HOST=example.com
#LETSENCRYPT_EMAIL=apotwohd@gmail.com #LETSENCRYPT_EMAIL=someemail.email.com
# Variables needed in build time # Variables needed in build time
# to_never_do: change bellow to localhost # to_never_do: change APELLA_HOST to localhost
APELLA_HOST=0.0.0.0 APELLA_HOST=0.0.0.0
APELLA_PORT=3000 APELLA_PORT=3000
GANACHE_HOST=79.103.177.105 GANACHE_HOST=xx.xxx.xxx.xxx
GANACHE_PORT=8545 GANACHE_PORT=8545
# react-scripts host and port vars
HOST=0.0.0.0
PORT=3000
# Variables needed in runtime (in browser) # Variables needed in runtime (in browser)
REACT_APP_RENDEZVOUS_HOST=83.212.109.171 REACT_APP_RENDEZVOUS_HOST=xx.xxx.xxx.xxx
REACT_APP_RENDEZVOUS_PORT=9090 REACT_APP_RENDEZVOUS_PORT=9090

6
truffle-config.js

@ -1,4 +1,6 @@
const path = require('path'); const path = require('path');
const GANACHE_HOST = process.env.GANACHE_HOST || 'localhost';
const GANACHE_PORT = process.env.GANACHE_PORT || '8545';
module.exports = { module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration> // See <http://truffleframework.com/docs/advanced/configuration>
@ -6,8 +8,8 @@ module.exports = {
contracts_build_directory: path.join(__dirname, 'app/src/contracts'), contracts_build_directory: path.join(__dirname, 'app/src/contracts'),
networks: { networks: {
development: { development: {
host: process.env.GANACHE_HOST, host: GANACHE_HOST,
port: process.env.GANACHE_PORT, port: GANACHE_PORT,
network_id: '*' // Match any network id network_id: '*' // Match any network id
} }
}, },

Loading…
Cancel
Save