I have configured our Fabric network (v1.4) with Explorer (latest version).
node --version v8.16.0
No errors in db log
No application level errors
Explorer syncing process is going on continuously for the network
Able to view the updated data in DB
http://localhost:8080/api-docs/ (Explorer Swagger) works fine.
However while accessing http://localhost:8080/ i am getting
Cannot GET / error.
Chrome inspect logs -
Failed to load resource: the server responded with a status of http://localhost:8080/ 404 (Not Found)
console logs -
[2020-01-28T22:30:53.167] [INFO] PgService - SSL to Postgresql disabled
[2020-01-28T22:30:53.167] [INFO] PgService - connecting to Postgresql postgres://hppoc:******#127.0.0.1:5432/fabricexplorer
[2020-01-28T22:30:54.285] [INFO] Platform - client_configs.name first-network client_configs.profile ./connection-profile/first-network.json
[2020-01-28T22:30:54.285] [INFO] Platform - FabricUtils.createFabricClient
[2020-01-28T22:30:54.286] [INFO] FabricConfig - config.client.tlsEnable true
[2020-01-28T22:30:54.287] [INFO] FabricGateway - peer0.org1.example.com
[2020-01-28T22:30:54.287] [INFO] FabricGateway - /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/signcerts/Admin#org1.example.com-cert.pem
adminPrivateKeyPath /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/keystore/e65fa2dd29a69b2b28f9e439d1a8d555d411e9906e5a20d0a7341207a3a46424_sk
[2020-01-28T22:30:54.287] [INFO] FabricConfig - FabricConfig, this.config.channels mychannel
[2020-01-28T22:30:54.607] [INFO] FabricClient - FabricClient.discover_results endpoint { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:54.638] [INFO] Platform - FabricUtils.createDetachClient
[2020-01-28T22:30:54.640] [INFO] Platform - initializeListener, client_name, client first-network { name: 'first-network',
profile: './connection-profile/first-network.json' }
[2020-01-28T22:30:54.646] [INFO] main - Please open web browser to access :http://localhost:8080/
[2020-01-28T22:30:54.646] [INFO] main - pid is 18213
[2020-01-28T22:30:54.782] [INFO] PgService - SSL to Postgresql disabled
[2020-01-28T22:30:54.782] [INFO] PgService - connecting to Postgresql postgres://hppoc:******#127.0.0.1:5432/fabricexplorer
[2020-01-28T22:30:55.397] [INFO] SyncPlatform - Updating the client network and other details to DB
[2020-01-28T22:30:55.404] [INFO] SyncServices - SyncServices.synchNetworkConfigToDB client first-network channel_name mychannel
[2020-01-28T22:30:55.427] [INFO] FabricClient - FabricClient.discover_results endpoint { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:55.528] [INFO] SyncPlatform - Sync process is started for the network : [first-network] and client : [first-network]
[2020-01-28T22:30:55.530] [INFO] FabricConfig - config.client.tlsEnable true
[2020-01-28T22:30:55.530] [INFO] FabricGateway - peer0.org1.example.com
[2020-01-28T22:30:55.530] [INFO] FabricGateway - /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/signcerts/Admin#org1.example.com-cert.pem
adminPrivateKeyPath /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/keystore/e65fa2dd29a69b2b28f9e439d1a8d555d411e9906e5a20d0a7341207a3a46424_sk
[2020-01-28T22:30:55.530] [INFO] FabricConfig - FabricConfig, this.config.channels mychannel
[2020-01-28T22:30:55.798] [INFO] FabricClient - FabricClient.discover_results endpoint { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:55.833] [INFO] SyncServices - SyncServices.synchNetworkConfigToDB client first-network channel_name mychannel
[2020-01-28T22:30:55.865] [INFO] FabricClient - FabricClient.discover_results endpoint { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:55.883] [INFO] Sync - Synchronizer pid is 18220
[2020-01-28T22:30:55.901] [INFO] SyncServices - block_row.blocknum 4
[2020-01-28T22:30:58.200] [INFO] SyncPlatform - Updating the client network and other details to DB
[2020-01-28T22:30:58.209] [INFO] SyncServices - SyncServices.synchNetworkConfigToDB client first-network channel_name mychannel
[2020-01-28T22:30:58.241] [INFO] FabricClient - FabricClient.discover_results endpoint { host: 'orderer.example.com', port: 7050 }
So, I found the answer to the problem -
Weirdly the problem was it shows everywhere that it serves on localhost:8080 but after a lot of research found out that node js cannot serve static pages which hyperledger explorer is on port 8080.
So, needs to use "serve" to build and serve that page. I had did that 2 days back, it starts on port 5000 and it`s own IP address, but I was getting error on web browser for violation of "control security policy".
Solution :
$ cd ~/Hyperledger/blockchain-explorer/client
$ npm install
$ npm test -- -u --coverage
$ npm run build
$ npm install -g serve
$ serve -s build
Now it will show you the output something like :
┌────────────────────────────────────────────────────┐
│ │
│ Serving! │
│ │
│ - Local: http://localhost:5000 │
│ - On Your Network: http://160.33.244.178:5000 │
│ │
│ Copied local address to clipboard! │
│ │
└────────────────────────────────────────────────────┘
If you open up : http://localhost:5000 it will not show anything and in the network logs on inspect window will show you - "control security policy violation".
so use port 8080 instead like this :
- Local: http://localhost:8080 │
- On Your Network: http://160.33.244.178:8080
Also, you would need to start the hyperldger explorer server :
$ cd ~/<YourPath>/blockchain-explorer
$ ./start.sh
You will see login page with first network selected.
Use :
"adminUser" is the the admin user of the network, in this case it's fabric CA or an identity user.
"adminPassword" is the password for the admin user.
and you are in !
If you start explorer using docker compose, that is in root of repo, then check your 8090 port, cause docker map 8080 port of container to 8090 port of your machine.
See github:hyperledger/blockain-explorer/docker-compose.yaml
Related
This question already has answers here:
Docker - Can't reach database server at `localhost`:`3306` with Prisma service
(2 answers)
ECONNREFUSED for Postgres on nodeJS with dockers
(7 answers)
Closed 17 days ago.
This post was edited and submitted for review 16 days ago and failed to reopen the post:
Original close reason(s) were not resolved
I am trying to build a docker image from my project and run it in a container,
The project is keystone6 project connecting to a postgres database, everything worked well when I normally run the project and it connects successfully to the database.
Here is my dockerfile:
FROM node:18.13.0-alpine3.16
ENV NODE_VERSION 18.13.0
ENV NODE_ENV=development
LABEL Name="di-wrapp" Version="1"
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . .
RUN npm install
COPY .env .
EXPOSE 9999
CMD ["npm", "run", "dev"]
I am building an image using the command docker build -t di-wrapp:1.0 .
after that I run docker-compose file which contains the following code:
version: "3.8"
services:
postgres:
image: postgres:15-alpine
container_name: localhost
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=di_wrapp
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
dashboard:
image: di-wrapp:1.0
container_name: di-wrapp-container
restart: always
environment:
- DB_CONNECTION=postgres
- DB_PORT=5432
- DB_HOST=localhost
- DB_USER=postgres
- DB_PASSWORD=postgres
- DB_NAME=di_wrapp
tty: true
depends_on:
- postgres
ports:
- 8273:9999
links:
- postgres
command: "npm run dev"
volumes:
- /usr/src/app
volumes:
postgres-data:
And this is the connection URI used to connect my project to postgres:
DATABASE_URL=postgresql://postgres:postgres#localhost:5432/di_wrapp
which I am using to configure my db setting in keystone config file like this:
export const db: DatabaseConfig<BaseKeystoneTypeInfo> = {
provider: "postgresql",
url: String(DATABASE_URL!),
};
when I run the command docker-compose -f docker-compose.yaml up
This is what I receive:
localhost | 2023-02-03 13:43:35.034 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
localhost | 2023-02-03 13:43:35.034 UTC [1] LOG: listening on IPv6 address "::", port 5432
localhost | 2023-02-03 13:43:35.067 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
localhost | 2023-02-03 13:43:35.121 UTC [24] LOG: database system was shut down at 2023-02-03 13:43:08 UTC
localhost | 2023-02-03 13:43:35.155 UTC [1] LOG: database system is ready to accept connections
di-wrapp-container | > keystone-app#1.0.2 dev
di-wrapp-container | > keystone dev
di-wrapp-container |
di-wrapp-container | ✨ Starting Keystone
di-wrapp-container | ⭐️ Server listening on :8273 (http://localhost:8273/)
di-wrapp-container | ⭐️ GraphQL API available at /api/graphql
di-wrapp-container | ✨ Generating GraphQL and Prisma schemas
di-wrapp-container | Error: P1001: Can't reach database server at `localhost`:`5432`
di-wrapp-container |
di-wrapp-container | Please make sure your database server is running at `localhost`:`5432`.
di-wrapp-container | at Object.createDatabase (/usr/src/app/node_modules/#prisma/internals/dist/migrateEngineCommands.js:115:15)
di-wrapp-container | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
di-wrapp-container | at async ensureDatabaseExists (/usr/src/app/node_modules/#keystone-6/core/dist/migrations-e3b5740b.cjs.dev.js:262:19)
di-wrapp-container | at async Object.pushPrismaSchemaToDatabase (/usr/src/app/node_modules/#keystone-6/core/dist/migrations-e3b5740b.cjs.dev.js:68:3)
di-wrapp-container | at async Promise.all (index 1)
di-wrapp-container | at async setupInitialKeystone (/usr/src/app/node_modules/#keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js:984:3)
di-wrapp-container | at async initKeystone (/usr/src/app/node_modules/#keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js:762:35)di-wrapp-container exited with code 1
even though I receive that the database server is up on port 5432, my app container can't connect to it.
any help is appreciated.
I have been struggling for some days now to deploy an Azure App Service with two minimalist Docker containers.
My first image is a basic PostgreSQL image and my second image is built with the following Dockerfile:
FROM python:3.7
RUN pip install streamlit
COPY app.py /streamlit-docker/
WORKDIR /streamlit-docker/
CMD streamlit run app.py
and where app.py is:
import streamlit as st
st.write('Hello world')
The docker-compose.yml file I use for creating my Azure App service is the following:
version: '3.3'
services:
db:
image: atestcr.azurecr.io/postgres:latest
environment:
POSTGRES_PASSWORD: postgres
app:
image: atestcr.azurecr.io/my_app:latest
ports:
- '8501:8501'
I get an 'Application Error' whenever I try to access the webapp URL. However, when I deploy this app with a single docker container, using this docker-compose.yml:
version: '3.3'
services:
app:
image: atestcr.azurecr.io/my_app:latest
ports:
- '8501:8501'
everything works fine.
Here is a GitHub repo to recreate the bug.
These are the Azure logs:
2021-08-09T17:29:34.382Z INFO - Starting multi-container app..
2021-08-09T17:29:35.089Z INFO - Pulling image: atestcr.azurecr.io/postgres:latest
2021-08-09T17:29:35.313Z INFO - latest Pulling from postgres
2021-08-09T17:29:35.315Z INFO - Digest: sha256:b6df1345afa5990ea32866e5c331eefbf2e30a05f2a715c3a9691a6cb18fa253
2021-08-09T17:29:35.317Z INFO - Status: Image is up to date for atestcr.azurecr.io/postgres:latest
2021-08-09T17:29:35.319Z INFO - Pull Image successful, Time taken: 0 Minutes and 0 Seconds
2021-08-09T17:29:35.335Z INFO - Starting container for site
2021-08-09T17:29:35.335Z INFO - docker run -d -p 8477:5432 --name testapp32_db_0_6662435d -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=testapp32 -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=testapp32.azurewebsites.net -e WEBSITE_INSTANCE_ID=42c09ff46e6c54cb467d28e88f2ab5b1e8971ee4daf2e883f44401bde67fe89f -e HTTP_LOGGING_ENABLED=1 atestcr.azurecr.io/postgres:latest
2021-08-09T17:29:35.781Z INFO - Pulling image: atestcr.azurecr.io/my_app:latest
2021-08-09T17:29:35.984Z INFO - latest Pulling from my_app
2021-08-09T17:29:35.987Z INFO - Digest: sha256:659937a52a6223b938b3d429901ab8648497870bf8068b5dcc05816050db5eaf
2021-08-09T17:29:35.988Z INFO - Status: Image is up to date for atestcr.azurecr.io/my_app:latest
2021-08-09T17:29:35.993Z INFO - Pull Image successful, Time taken: 0 Minutes and 0 Seconds
2021-08-09T17:29:36.014Z INFO - Starting container for site
2021-08-09T17:29:36.014Z INFO - docker run -d -p 0:8501 --name testapp32_app_0_6662435d -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=testapp32 -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=testapp32.azurewebsites.net -e WEBSITE_INSTANCE_ID=42c09ff46e6c54cb467d28e88f2ab5b1e8971ee4daf2e883f44401bde67fe89f -e HTTP_LOGGING_ENABLED=1 atestcr.azurecr.io/my_app:latest
2021-08-09T17:33:26.741Z ERROR - multi-container unit was not started successfully
2021-08-09T17:33:26.846Z INFO - Container logs from testapp32_db_0_6662435d = 2021-08-09T17:29:40.459721366Z The files belonging to this database system will be owned by user "postgres".
2021-08-09T17:29:40.491740899Z This user must also own the server process.
2021-08-09T17:29:40.493019808Z
2021-08-09T17:29:40.497263739Z The database cluster will be initialized with locale "en_US.utf8".
2021-08-09T17:29:40.502456876Z The default database encoding has accordingly been set to "UTF8".
2021-08-09T17:29:40.503203182Z The default text search configuration will be set to "english".
2021-08-09T17:29:40.503218482Z
2021-08-09T17:29:40.503223282Z Data page checksums are disabled.
2021-08-09T17:29:40.506809008Z
2021-08-09T17:29:40.521275113Z fixing permissions on existing directory /var/lib/postgresql/data ... ok
2021-08-09T17:29:40.523912632Z creating subdirectories ... ok
2021-08-09T17:29:40.525237242Z selecting dynamic shared memory implementation ... posix
2021-08-09T17:29:40.642905697Z selecting default max_connections ... 100
2021-08-09T17:29:40.733900958Z selecting default shared_buffers ... 128MB
2021-08-09T17:29:41.039050775Z selecting default time zone ... Etc/UTC
2021-08-09T17:29:41.047757638Z creating configuration files ... ok
2021-08-09T17:29:44.416903507Z running bootstrap script ... ok
2021-08-09T17:29:50.023628737Z performing post-bootstrap initialization ... ok
2021-08-09T17:30:04.217544961Z syncing data to disk ... ok
2021-08-09T17:30:04.218321267Z
2021-08-09T17:30:04.219189873Z initdb: warning: enabling "trust" authentication for local connections
2021-08-09T17:30:04.219206473Z You can change this by editing pg_hba.conf or using the option -A, or
2021-08-09T17:30:04.219223973Z --auth-local and --auth-host, the next time you run initdb.
2021-08-09T17:30:04.219491175Z
2021-08-09T17:30:04.219513275Z Success. You can now start the database server using:
2021-08-09T17:30:04.219519575Z
2021-08-09T17:30:04.219523675Z pg_ctl -D /var/lib/postgresql/data -l logfile start
2021-08-09T17:30:04.219527775Z
2021-08-09T17:30:08.340584036Z waiting for server to start.......2021-08-09 17:30:08.340 UTC [44] LOG: starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2021-08-09T17:30:08.478247580Z 2021-08-09 17:30:08.410 UTC [44] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-08-09T17:30:08.680599067Z 2021-08-09 17:30:08.680 UTC [45] LOG: database system was shut down at 2021-08-09 17:29:49 UTC
2021-08-09T17:30:08.753589768Z 2021-08-09 17:30:08.753 UTC [44] LOG: database system is ready to accept connections
2021-08-09T17:30:08.755965684Z done
2021-08-09T17:30:08.760382514Z server started
2021-08-09T17:30:09.790821978Z
2021-08-09T17:30:09.799723839Z /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
2021-08-09T17:30:09.802079455Z
2021-08-09T17:30:09.840304817Z 2021-08-09 17:30:09.834 UTC [44] LOG: received fast shutdown request
2021-08-09T17:30:09.862102366Z waiting for server to shut down....2021-08-09 17:30:09.861 UTC [44] LOG: aborting any active transactions
2021-08-09T17:30:09.950488072Z 2021-08-09 17:30:09.950 UTC [44] LOG: background worker "logical replication launcher" (PID 51) exited with exit code 1
2021-08-09T17:30:09.954360498Z 2021-08-09 17:30:09.950 UTC [46] LOG: shutting down
2021-08-09T17:30:13.063848848Z ...2021-08-09 17:30:13.063 UTC [44] LOG: database system is shut down
2021-08-09T17:30:13.138558463Z done
2021-08-09T17:30:13.140082774Z server stopped
2021-08-09T17:30:13.144102302Z
2021-08-09T17:30:13.162430928Z PostgreSQL init process complete; ready for start up.
2021-08-09T17:30:13.165654351Z
2021-08-09T17:30:14.083504086Z 2021-08-09 17:30:13.992 UTC [1] LOG: starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2021-08-09T17:30:14.084760295Z 2021-08-09 17:30:14.011 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-08-09T17:30:14.084774095Z 2021-08-09 17:30:14.015 UTC [1] LOG: listening on IPv6 address "::", port 5432
2021-08-09T17:30:14.084779495Z 2021-08-09 17:30:14.082 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-08-09T17:30:14.156076187Z 2021-08-09 17:30:14.132 UTC [63] LOG: database system was shut down at 2021-08-09 17:30:12 UTC
2021-08-09T17:30:14.198749982Z 2021-08-09 17:30:14.176 UTC [1] LOG: database system is ready to accept connections
2021-08-09T17:30:15.006882460Z 2021-08-09 17:30:14.998 UTC [70] LOG: invalid length of startup packet
2021-08-09T17:30:16.112919592Z 2021-08-09 17:30:16.112 UTC [71] LOG: invalid length of startup packet
2021-08-09T17:30:17.178350344Z 2021-08-09 17:30:17.174 UTC [72] LOG: invalid length of startup packet
...
2021-08-09T17:33:25.735293291Z 2021-08-09 17:33:25.735 UTC [260] LOG: invalid length of startup packet
2021-08-09T17:33:29.142Z INFO - Container logs from testapp32_app_0_6662435d = 2021-08-09T17:30:24.010212694Z
2021-08-09T17:30:24.011085300Z You can now view your Streamlit app in your browser.
2021-08-09T17:30:24.011101800Z
2021-08-09T17:30:24.012092107Z Network URL: http://172.16.232.3:8501
2021-08-09T17:30:24.012855612Z External URL: http://20.40.148.207:8501
2021-08-09T17:30:24.013407416Z
2021-08-09T17:33:36.002Z INFO - Stopping site testapp32 because it failed during startup.
It's worth noting your shared example doesn't work because your docker-compose.yml is using your own private container registries.
However, tinkering around the edges I have managed to get your dummy example working with changes to the following files:
Your app dockerfile:
FROM python:3.7
RUN pip install streamlit
COPY app.py /streamlit-docker/
WORKDIR /streamlit-docker/
EXPOSE 80
CMD streamlit run app.py --server.port 80
And adjusting your docker-compose.yml
version: '3.3'
services:
db:
image: postgis/postgis:13-master
environment:
- POSTGRES_DB=counterfactualcovid
- POSTGRES_USER=django
- POSTGRES_PASSWORD=django
app:
image: testazurecontainerregistryajc.azurecr.io/mcmegaapp:latest
ports:
- '80:80'
Ignore the fact i've used a generic postgres docker image and my own private container registry for the images and you'll see the key changes are:
in the Dockerfile exposing port 80, and adding --server.port 80 to the streamlit CMD call
in the docker-compose.yml setting the port forwarding to 80:80
I /think/ your issues arise from the preview limitations for the multi-container web apps feature, so setting everything to work via port 80 appears to resolve this.
I have configured 2 CA for 2 Org (1 CA/1 Org). I have used Port- 7054:7054 for 1st CA and Port- 8054:8054 for 2nd CA.But when I do 'docker logs for 2nd CA container I am getting this- 2019/08/18 19:54:19 [INFO] Listening on http://0.0.0.0:7054 .Is in't it should be 8054 as I configured port 8054:8054 in docker-compose file for 2nd CA.? If yes, where I am doing wrong and where should I update?
My CA service in docker-compose file---
services:
ca0:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org1
- FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
- FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/9a834d764f3ec2ee602e073dc27a971add2052c84024efe3e5224fa5485053e9_sk
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/9a834d764f3ec2ee602e073dc27a971add2052c84024efe3e5224fa5485053e9_sk -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerOrg1
networks:
- basic
ca1:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org2
- FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem
- FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/557164d9dc484f634bc058938bac0c68fb56f60ab0359f369ececfe6c7199a53_sk
ports:
- "8054:8054"
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/557164d9dc484f634bc058938bac0c68fb56f60ab0359f369ececfe6c7199a53_sk -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerOrg2
networks:
- basic
#Subhra Sankha Bose #Nipun Tharuksha
We can change default values in every open source projects
You are missing one env variable to override the default port 7054
Add this to environment:
- FABRIC_CA_SERVER_PORT=8054
After adding the env see below my logs
2019/08/19 08:34:15 [INFO] Home directory for default CA: /etc/hyperledger/fabric-ca-server
2019/08/19 08:34:15 [DEBUG] 1 CA instance(s) running on server
2019/08/19 08:34:15 [INFO] Operation Server Listening on 127.0.0.1:9443
2019/08/19 08:34:15 [DEBUG] TLS is enabled
2019/08/19 08:34:15 [DEBUG] TLS Certificate: /etc/hyperledger/fabric-ca-server-config/ca.nbd-cert.pem, TLS Key: /etc/hyperledger/fabric-ca-server-config/8b3bb8a74b5901f03c8d0901233f5b0ea2b2800e4176dcada7ade4932df565e1_sk
2019/08/19 08:34:15 [DEBUG] Client authentication type requested: noclientcert
2019/08/19 08:34:15 [INFO] Listening on https://0.0.0.0:8054
Just configure your 2nd CA with Port- 8054:7054 because internally CA is configured to listen on port 7054 only so you just have to define external port for your CA(here 8054).
I am using the given link for exploring the fabric-ca
http://fabric-ca.readthedocs.io/en/latest/users-guide.html
Following the content in the link, I am trying to setup fabric-ca-server with mysql as DB and I am specifying the below config for the same in the fabric-ca-server-config.yaml
db:
type: mysql
datasource: root:**123##tcp(localhost:3306)/fabric_ca?parseTime=true
tls:
enabled: false
certfiles:
- db-server-cert.pem
client:
certfile: db-client-cert.pem
keyfile: db-client-key.pem
I do not pass the argument tls=custom in 'datasource' above as I am not using the TLS
Upon server startup I get
root#Openwhisk-Node2-172:~/fabric-ca/fabric-ca-server# fabric-ca-server start -b admin:adminpw
2017/09/05 15:25:17 [INFO] Configuration file location: /root/fabric-ca/fabric-ca-server/fabric-ca-server-config.yaml
2017/09/05 15:25:17 [INFO] Starting server in home directory: /root/fabric-ca/fabric-ca-server
2017/09/05 15:25:17 [INFO] The CA key and certificate already exist
2017/09/05 15:25:17 [INFO] The key is stored by BCCSP provider 'SW'
2017/09/05 15:25:17 [INFO] The certificate is at: /root/fabric-ca/fabric-ca-server/ca-cert.pem
2017/09/05 15:25:17 [INFO] Initialized mysql database at root:Nokia123##tcp(localhost:3306)/fabric_ca?parseTime=true
2017/09/05 15:25:17 [INFO] Home directory for default CA: /root/fabric-ca/fabric-ca-server
2017/09/05 15:25:17 [INFO] Listening on %!s(int=7054)%!(EXTRA string=http://0.0.0.0:7054)
but when I try to use the client for enroll bootstrap identity, I get
fabric-ca-client enroll -u http://admin:adminpw#localhost:7054
2017/09/05 15:27:40 [INFO] User provided config file: /root/fabric-ca/fabric-ca-client1/admin/fabric-ca-client-config.yaml
2017/09/05 15:27:40 [INFO] Created a default configuration file at /root/fabric-ca/fabric-ca-client1/admin/fabric-ca-client-config.yaml
2017/09/05 15:27:40 [INFO] generating key: &{A:ecdsa S:256}
2017/09/05 15:27:40 [INFO] encoded CSR
Error: Error response from server was: Authorization failure
The database is up.
I have also created a database with name fabric_ca
NO_ZERO_DATE related changes are also done
Kindly help. let me know if some steps I have missed or if I have done something wrong
If you actually created the database prior to running the fabric-ca-server that's likely the issue. The code currently just checks to see if the database exists. If it exists, then it does not run any of the SQL setup scripts. So the best best is to just start with a clean MYSQL which does not have any database instance created.
I've installed Mist on my local PC (Windows 10), but I don't want to sync Main/Test networks. So I've used this Ethereum + Azure tutorial and now I can work via SSH on my private network.
geth --dev console
More than that, I know that it's possible to run Mist on custom blockchain using special flag
mist.exe --rpc http://YOUR_IP:PORT
So, according to geth --help, I'm running geth --dev --rpc console on Azure's virtual machine, after that I'm running mist.exe --rpc http://VM_IP:8545 and there is an error:
[2016-09-24 18:01:21.928] [INFO] Sockets/node-ipc - Connect to {"hostPort":"http://VM_IP:8545"}
[2016-09-24 18:01:24.968] [ERROR] Sockets/node-ipc - Connection failed (3000ms elapsed)
[2016-09-24 18:01:24.971] [WARN] EthereumNode - Failed to connect to node. Maybe it's not running so let's start our own...
[2016-09-24 18:01:24.979] [INFO] EthereumNode - Node type: geth
[2016-09-24 18:01:24.982] [INFO] EthereumNode - Network: test
[2016-09-24 18:01:24.983] [INFO] EthereumNode - Start node: geth test
[2016-09-24 18:01:32.284] [INFO] EthereumNode - 3000ms elapsed, assuming node started up successfully
[2016-09-24 18:01:32.286] [INFO] EthereumNode - Started node successfully: geth test
[2016-09-24 18:01:32.327] [INFO] Sockets/node-ipc - Connect to {"hostPort":"http://VM_IP:8545"}
[2016-09-24 18:02:02.332] [ERROR] Sockets/node-ipc - Connection failed (30000ms elapsed)
[2016-09-24 18:02:02.333] [ERROR] EthereumNode - Failed to connect to node Error: Unable to connect to socket: timeout
P.S. Mist version - 0.8.2
Your approach is correct. I would say that you have a network configuration issue that prevents your Mist to talk to geth.
I would suggest doing the following test and see if you run into the same issue:
- on the machine where you have Mist, find the geth.exe executable
- run geth with geth --testnet --rpc
- start mist with ./Mist --rpc /.../Ethereum/testnet/geth.ipc or ./Mist --rpc http://localhost:8545
I am on a Mac so I guess you will have to reverse the / and add some C: decorations here and there.