@velmurugan I added docker
and docker-compose
files to the app and updated the instructions. Give it a try.
Hello @yannis,
I tried deploying and found issues in it.
I did the following steps,
Step 1 - Cloned the repository from using the command,
git clone https://gitlab.coko.foundation/kotahi/kotahi.git
and then,
cd kotahi
yarn
Step 2 - Created a database.
Step 3 - Created a development.env and included the following inside it,
export ORCID_CLIENT_ID=client id
export ORCID_CLIENT_SECRET= client secret
export POSTGRES_USER=‘kotahidevelopment’
export POSTGRES_PASSWORD=‘password’
export POSTGRES_HOST=‘localhost’
export POSTGRES_DB=‘kotahidevelopment’
export POSTGRES_PORT=‘5432’
export NODE_ENV=‘development’
export PUBSWEET_SECRET=‘secret-key’
export SERVER_PORT=‘4080’
export SERVER_HOST=‘server’
export SERVER_PROTOCOL=‘http’
and changed the following in development.js file,
‘pubsweet-server’: {
db: {
database: ‘kotahidevelopment’,
user: ‘kotahidevelopment’,
password: ‘password’,
port: 5432,
},
port: process.env.PORT || 4080,
pool: { min: 0, max: 10, idleTimeoutMillis: 1000 },
baseUrl: http://localhost:4000
,
secret: ‘secret-string’,
},
Step 5 - Created admin user using,
await User.query().update({admin: true})
Step 6 - Brought up the development environment using,
docker-compose up
Step 7 - To run the app for production ,
docker-compose -f docker-compose.production.yml up
When I tried to run Step 5 and 6, I received the following error,
(node:78) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 172.30.0.4:5435
server_1 | at Object.raw (/home/node/app/node_modules/knex/lib/util/make-knex.js:114:30)
server_1 | at Function.value (/home/node/app/node_modules/knex/lib/util/make-knex.js:90:29)
server_1 | at Object.executeSql (/home/node/app/node_modules/pubsweet-server/src/jobs/index.js:19:17)
server_1 | at Contractor.isInstalled (/home/node/app/node_modules/pg-boss/lib/contractor.js:1462:20)
server_1 | at Contractor.start (/home/node/app/node_modules/pg-boss/lib/contractor.js:1528:17)
server_1 | at PgBoss.start (/home/node/app/node_modules/pg-boss/lib/index.js:1767:34)
server_1 | at startJobQueue (/home/node/app/node_modules/pubsweet-server/src/jobs/index.js:60:16)
server_1 | at Function.app.onListen (/home/node/app/server/app.js:159:11)
server_1 | at startServer (/home/node/app/node_modules/pubsweet-server/src/start-server.js:41:23)
server_1 | at processTicksAndRejections (internal/process/task_queues.js:97:5)
server_1 | (node:78) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
server_1 | (node:78) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Where have I gone wrong? Please guide me in this.
Hi @ShibinaS
A few things to note:
- You don’t need to
yarn
after cloning if you’re gonna run the app inside docker. The dependencies will be installed inside the docker container. - You also shouldn’t ever need to edit
config/development.js
. I highly recommend you check the load order ofnode-config
(the underlying library here), but the gist of it is that the value of the environment variable will be the value applied. You only need to make sure the environment variables are there. - I’m also a bit confused, cause you’re loading an env file with
NODE_ENV=development
and running the development instructions. But your last step is to run the production docker compose setup. You should either run one or the other.
To sum it up, if you’re trying to run this in development, you do the following:
- Clone repo
-
cd
into folder source your-env-file.env
docker-compose up
For production:
- Clone repo
-
cd
into folder - Make sure your database is up and reachable somewhere
source your-env-file.env
docker-compose -f docker-compose.production.yml up
I’m going to make the assumption here that you want to run this for production, so please follow the steps above and let me know if it works. As far as the ECONNREFUSED
error is concerned, it means that your database is not reachable at that url. You can use something like psql
to validate that the db is reachable before you run the app.
Hi @yannis,
Tried this. I did the following steps,
-
created an env file and set the following variables to it,
export NODE_ENV=‘development’
export POSTGRES_USER
export POSTGRES_PASSWORD
export POSTGRES_HOST=‘localhost’
export POSTGRES_DB
export POSTGRES_PORT
export PUBSWEET_SECRET
export ORCID_CLIENT_ID
export ORCID_CLIENT_SECRET
export SERVER_PORT=‘7007’ -
Clone repo
-
cd into folder
-
sourced env file
-
docker-compose up
I received the following error,
(node:50) UnhandledPromiseRejectionWarning: Error: Missing auth token
server_1 | at SubscriptionServer.onConnect (/home/node/app/server/subscriptions.js:25:19)
server_1 | at /home/node/app/node_modules/subscriptions-transport-ws/dist/server.js:123:47
server_1 | at new Promise ()
server_1 | at WebSocket. (/home/node/app/node_modules/subscriptions-transport-ws/dist/server.js:121:57)
server_1 | at WebSocket.emit (events.js:314:20)
server_1 | at Receiver.receiverOnMessage (/home/node/app/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket.js:720:20)
server_1 | at Receiver.emit (events.js:314:20)
server_1 | at Receiver.dataMessage (/home/node/app/node_modules/subscriptions-transport-ws/node_modules/ws/lib/receiver.js:414:14)
server_1 | at Receiver.getData (/home/node/app/node_modules/subscriptions-transport-ws/node_modules/ws/lib/receiver.js:346:17)
server_1 | at Receiver.startLoop (/home/node/app/node_modules/subscriptions-transport-ws/node_modules/ws/lib/receiver.js:133:22)
server_1 | at Receiver._write (/home/node/app/node_modules/subscriptions-transport-ws/node_modules/ws/lib/receiver.js:69:10)
server_1 | at doWrite (_stream_writable.js:403:12)
server_1 | at writeOrBuffer (_stream_writable.js:387:5)
server_1 | at Receiver.Writable.write (_stream_writable.js:318:11)
server_1 | at Socket.socketOnData (/home/node/app/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket.js:795:35)
server_1 | at Socket.emit (events.js:314:20)
Please guide me.
Hey, the app should be running if you get this error. Am I right?
This is an annoying log output happening on kotahi’s backend, but it shouldn’t affect functionality. Simply logging in should make this go away.
Just to be clear though, with the instructions you posted above, you are using the development environment. Which is fine for you to test things out, but if you’re gonna deploy, you should be using the production environment.
Hey @yannis,
Yes, Im using the development environment. But I dont find the app running anywhere. Console says that,
server_1 | error: message=ENOENT: no such file or directory, stat ‘/home/node/app/_build/index.html’, stack=Error: ENOENT: no such file or directory, stat ‘/home/node/app/_build/index.html’, errno=-2, code=ENOENT, syscall=stat, path=/home/node/app/_build/index.html, expose=false, statusCode=404, status=404
server_1 | error: Error: ENOENT: no such file or directory, stat ‘/home/node/app/_build/index.html’
server_1 | info: ::ffff:172.30.0.1 - - [14/Dec/2020:05:23:02 +0000] “GET / HTTP/1.1” 404 88 “-” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36”
Please find the screenshots beow,
Hmm. I’ll fix that.
So 7007 is the server port? If you go to localhost:7007/graphql
does it open the graphql playground?
Hi Yannis,
This deployment is pending for more than a month.
Can we have a dedicated session with both sides to complete the installation?
Yeap, ping me on mattermost to find a time.
This deployment is pending for more than a month.
I was under the impression that this had been resolved mid-October.
But I dont find the app running anywhere.
Just for clarity, it should already be working. What you see at localhost:4002
is the app. I need to make that error go away on the server, but that shouldn’t affect functionality. The /graphql
endpoint is fine and the client seems to be up and running.
@velmurugan One more thing, cause it’s a bit “hidden”. On the app, navigate to localhost:4002/login
to continue. Just in case you didn’t know already.
Hey @yannis,
Thanks.localhost:4200/login works. Will look into all the functionalities and let you know the feedback!
sounds good