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/
node_modules/
package-lock.json
yarn.lock
app/node_modules/
app/package-lock.json
app/yarn.lock

3
Dockerfile

@ -4,9 +4,6 @@ LABEL maintainer="apotwohd@gmail.com"
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
RUN apk --no-cache add build-base \
python3 && \

2
app/package.json

@ -38,7 +38,7 @@
"libp2p-websocket-star-rendezvous": "0.3.0"
},
"scripts": {
"start": "HOST=${APELLA_HOST} react-scripts start",
"start": "react-scripts start",
"rendezvous": "rendezvous --port=9090 --host=83.212.109.171",
"build": "react-scripts build",
"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
// and need to be turned on manually.
const ipfsOptions = {
@ -10,7 +13,7 @@ const ipfsOptions = {
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
// Use local signaling server (see also rendezvous script in package.json)
// 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
networks:
- apella-net
volumes:
- ./volumes/node_modules:/usr/apella/node_modules
expose:
- "3000"
@ -57,11 +55,11 @@ services:
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./volumes/nginx/conf:/etc/nginx/conf.d
- ./volumes/nginx/vhost:/etc/nginx/vhost.d
- ./volumes/nginx/html:/usr/share/nginx/html
- ./volumes/nginx/dhparam:/etc/nginx/dhparam
- ./volumes/nginx/certs:/etc/nginx/certs:ro
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- dhparam:/etc/nginx/dhparam
- certs:/etc/nginx/certs:ro
# Letsencrypt automated creation, renewal and use of Let's Encrypt certificates
# Reference:
@ -79,14 +77,20 @@ services:
networks:
- apella-net
volumes:
- ./volumes/nginx/conf:/etc/nginx/conf.d
- ./volumes/nginx/vhost:/etc/nginx/vhost.d
- ./volumes/nginx/html:/usr/share/nginx/html
- ./volumes/nginx/dhparam:/etc/nginx/dhparam
- ./volumes/nginx/certs:/etc/nginx/certs:rw
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- dhparam:/etc/nginx/dhparam
- certs:/etc/nginx/certs:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
# Networks in use
networks:
apella-net:
driver: bridge
volumes:
conf:
vhost:
html:
dhparam:
certs:

16
env/apella.env.example

@ -1,19 +1,23 @@
# Docker compose variables
VIRTUAL_HOST=apella.tk
VIRTUAL_HOST=example.com
VIRTUAL_PORT=3000
# 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
#LETSENCRYPT_HOST=apella.tk
#LETSENCRYPT_EMAIL=apotwohd@gmail.com
#LETSENCRYPT_HOST=example.com
#LETSENCRYPT_EMAIL=someemail.email.com
# 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_PORT=3000
GANACHE_HOST=79.103.177.105
GANACHE_HOST=xx.xxx.xxx.xxx
GANACHE_PORT=8545
# react-scripts host and port vars
HOST=0.0.0.0
PORT=3000
# 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

6
truffle-config.js

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

Loading…
Cancel
Save