diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..335eeb3a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +.env +.git +test diff --git a/.gitignore b/.gitignore index d46da1b7..be85dd82 100644 --- a/.gitignore +++ b/.gitignore @@ -113,4 +113,6 @@ dist .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz -.pnp.* \ No newline at end of file +.pnp.* + +mongodb_data \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6f697a3f..e15e5663 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,35 +14,35 @@ services: MONGO_INITDB_ROOT_PASSWORD: $MONGO_INITDB_ROOT_PASSWORD volumes: - ./init-mongo.sh:/docker-entrypoint-initdb.d/init-mongo.sh - - mongodb_data_container:/data/db - - mongo-express: - image: "mongo-express" - container_name: mongo-express - ports: - - "8081:8081" - depends_on: - - database - environment: - ME_CONFIG_MONGODB_SERVER: database - ME_CONFIG_MONGODB_AUTH_DATABASE: $MONGO_INITDB_DATABASE - ME_CONFIG_MONGODB_AUTH_USERNAME: $MONGO_DATABASE_USERNAME - ME_CONFIG_MONGODB_AUTH_PASSWORD: $MONGO_DATABASE_PASSWORD - ME_CONFIG_BASICAUTH_USERNAME: $ME_CONFIG_BASICAUTH_USERNAME - ME_CONFIG_BASICAUTH_PASSWORD: $ME_CONFIG_BASICAUTH_PASSWORD - ME_CONFIG_MONGODB_ENABLE_ADMIN: "false" - + - ./mongodb_data:/data/db + + # mongo-express: + # image: "mongo-express" + # container_name: mongo-express + # ports: + # - "8081:8081" + # depends_on: + # - database + # environment: + # ME_CONFIG_MONGODB_SERVER: database + # ME_CONFIG_MONGODB_AUTH_DATABASE: $MONGO_INITDB_DATABASE + # ME_CONFIG_MONGODB_AUTH_USERNAME: $MONGO_DATABASE_USERNAME + # ME_CONFIG_MONGODB_AUTH_PASSWORD: $MONGO_DATABASE_PASSWORD + # ME_CONFIG_BASICAUTH_USERNAME: $ME_CONFIG_BASICAUTH_USERNAME + # ME_CONFIG_BASICAUTH_PASSWORD: $ME_CONFIG_BASICAUTH_PASSWORD + # ME_CONFIG_MONGODB_ENABLE_ADMIN: "false" + api: - image: data-feed-app-api + image: witnet/data-feed-app-api ports: - "4000:4000" links: - database - depends_on: + depends_on: - database - environment: + environment: SERVER_PORT: $SERVER_PORT - DB_HOSTNAME: $DB_HOSTNAME + DB_HOSTNAME: $DB_HOSTNAME MONGO_PORT: $MONGO_PORT MONGO_DATABASE_USERNAME: $MONGO_DATABASE_USERNAME MONGO_DATABASE_PASSWORD: $MONGO_DATABASE_PASSWORD @@ -57,15 +57,12 @@ services: RINKEBY_PROVIDER: $RINKEBY_PROVIDER ui: - image: data-feed-app-ui - links: + image: witnet/data-feed-app-ui + links: - api ports: - "8080:8080" - depends_on: + depends_on: - api environment: - API_ENDPOINT: "http://api:4000" - -volumes: - mongodb_data_container: \ No newline at end of file + API_ENDPOINT: "http://api:4000" \ No newline at end of file diff --git a/packages/api/package.json b/packages/api/package.json index 531289f9..5638a23b 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -11,7 +11,7 @@ "start": "node dist/index.js", "test": "jest", "prepare": "yarn codegen", - "docker:build": "docker build . --no-cache -t data-feed-api --stream" + "docker:build": "docker build . --no-cache -t witnet/data-feed-app-api --stream" }, "license": "ISC", "devDependencies": { diff --git a/packages/api/sample.env b/packages/api/sample.env index 2e87887d..63b20b47 100644 --- a/packages/api/sample.env +++ b/packages/api/sample.env @@ -4,10 +4,6 @@ MONGO_PORT=27017 MONGO_DATABASE_USERNAME=your_username MONGO_DATABASE_PASSWORD=your_password MONGO_INITDB_DATABASE=database -MONGO_INITDB_ROOT_USERNAME=your_admin_username -MONGO_INITDB_ROOT_PASSWORD=your_admin_password -ME_CONFIG_BASICAUTH_USERNAME=your_mongo_express_username -ME_CONFIG_BASICAUTH_PASSWORD=your_mongo_express_password GOERLI_PROVIDER=https://goerli.infura.io/v3/ KOVAN_PROVIDER=https://kovan.infura.io/v3/ RINKEBY_PROVIDER=https://rinkeby.infura.io/v3/ \ No newline at end of file diff --git a/packages/api/src/database.ts b/packages/api/src/database.ts index d77cc70e..0779a772 100644 --- a/packages/api/src/database.ts +++ b/packages/api/src/database.ts @@ -8,8 +8,7 @@ export class MongoManager { async start (uri?: string): Promise { const mongoDbUri = uri || - `mongodb://${process.env.MONGO_DATABASE_USERNAME}:${process.env.MONGO_DATABASE_PASSWORD}@${process.env.DB_HOSTNAME}:${process.env.MONGO_PORT}/${process.env.DB_HOSTNAME}` - + `mongodb://${process.env.MONGO_DATABASE_USERNAME}:${process.env.MONGO_DATABASE_PASSWORD}@${process.env.DB_HOSTNAME}:${process.env.MONGO_PORT}` return this.connect(mongoDbUri, process.env.MONGO_INITDB_DATABASE as string) } diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index 92f52a43..68db6197 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -26,9 +26,11 @@ async function main () { const server = await createServer(repositories) - server.listen().then(({ url }) => { - console.log(`🚀 Server ready at ${url}`) - }) + server + .listen({ host: '0.0.0.0', port: process.env.SERVER_PORT }) + .then(({ url }) => { + console.log(`🚀 Server ready at ${url}`) + }) } main() diff --git a/packages/ui/.dockerignore b/packages/ui/.dockerignore index 5187a7a1..c2fe82ac 100644 --- a/packages/ui/.dockerignore +++ b/packages/ui/.dockerignore @@ -1,5 +1,4 @@ node_modules .env .git -test -readme.md \ No newline at end of file +test \ No newline at end of file diff --git a/packages/ui/package.json b/packages/ui/package.json index 3d3a4ab0..9be0152a 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -11,7 +11,7 @@ "lint:style": "stylelint \"**/*.{vue,css}\" --fix", "lint": "yarn lint:js && yarn lint:style", "test": "yarn jest", - "docker:build": "docker build . --no-cache -t data-feed-ui" + "docker:build": "docker build . --no-cache -t witnet/data-feed-app-ui" }, "dependencies": { "@fortawesome/free-brands-svg-icons": "^5.15.3", diff --git a/sample.env b/sample.env index b3e94c12..7e78ff93 100644 --- a/sample.env +++ b/sample.env @@ -1,4 +1,4 @@ -SERVER_PORT=3100 +SERVER_PORT=4000 DB_HOSTNAME=localhost MONGO_PORT=27017 MONGO_DATABASE_USERNAME=your_username @@ -7,4 +7,8 @@ MONGO_INITDB_DATABASE=database MONGO_INITDB_ROOT_USERNAME=your_admin_username MONGO_INITDB_ROOT_PASSWORD=your_admin_password ME_CONFIG_BASICAUTH_USERNAME=your_mongo_express_username -ME_CONFIG_BASICAUTH_PASSWORD=your_mongo_express_password \ No newline at end of file +ME_CONFIG_BASICAUTH_PASSWORD=your_mongo_express_password +GOERLI_PROVIDER=https://goerli.infura.io/v3/ +KOVAN_PROVIDER=https://kovan.infura.io/v3/ +RINKEBY_PROVIDER=https://rinkeby.infura.io/v3/ +API_ENDPOINT="http://api:4000" \ No newline at end of file