Dockerised setup of App Sync server
mahmoudajawad opened this issue · 7 comments
Hello, @EddyVerbruggen.
I was trying to spin my own App Sync server as I'm in need of applying similar technology in a project I'm working on now, and since the current repo doesn't include a [cloud-?]docker-ready setup, I went ahead and forked the repo and prepared a commit that works up until hitting login button, where the login POST call on the web interface would fail with error 500, although the daemon log is showing it is failing at a mysql query that it can be run directly on the mysql server (using maria) without any issues.
The commit: master...mahmoudajawad:master
Could you please:
- Help me get past login in order to use the service.
- Consider my work and whether it is worth merging into this project in order to make it possible for others who are in need of this project to spin their own as the official instance seems to be (is it?) abandoned.
Considerations:
I wrote and tested this on aarch64 device and I'm using mariadb instead of mysql as the later isn't supported well on aarch64. I'm also using podman instead of docker. Though, I'm having these differences, I'm expecting the login issue not to be related to either of them. Since I could be wrong, the issue can be isloated by changing the db service image to mysql:8 and then start the services using docker-compose up --build.
With the second comment to this PR, the docker-compose now is ready and working and can be used across the architectures.
Hi @mahmoudajawad,
I'm interested in mounting this with kubernetes and it's a lot like docker-compose. Could you contribute your docker-compose file please? Thank you!
ok, I have entered here and I have seen your repo. I have downloaded and run it with docker-compose up --build and I have the following error:
I have changed the public port of MySql to
ports:
- 33062: 3306
but I understand that this should not affect
appsync_1 | [2021-03-15T11:16:25.759] [DEBUG] cps:app - set Access-Control Header
appsync_1 | [2021-03-15T11:16:25.760] [DEBUG] cps:app - config common.storageType value: local
appsync_1 | [2021-03-15T11:16:25.760] [DEBUG] cps:app - config common.storageDir value: /data/storage
appsync_1 | [2021-03-15T11:16:25.760] [DEBUG] cps:app - checking storageDir fs.W_OK | fs.R_OK
appsync_1 | [2021-03-15T11:16:25.760] [DEBUG] cps:app - storageDir fs.W_OK | fs.R_OK is ok
appsync_1 | [2021-03-15T11:16:25.761] [DEBUG] cps:app - static download uri value: /download
appsync_1 | [2021-03-15T11:16:25.761] [DEBUG] startup - port 3000
appsync_1 | [2021-03-15T11:16:35.775] [ERROR] startup - ConnectionError [SequelizeConnectionError]: connect ETIMEDOUT
appsync_1 | at /opt/nativescript-app-sync-server/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:149:19
appsync_1 | at tryCatcher (/opt/nativescript-app-sync-server/node_modules/bluebird/js/release/util.js:16:23)
appsync_1 | at Promise._settlePromiseFromHandler (/opt/nativescript-app-sync-server/node_modules/bluebird/js/release/promise.js:512:31)
appsync_1 | at Promise._settlePromise (/opt/nativescript-app-sync-server/node_modules/bluebird/js/release/promise.js:569:18)
appsync_1 | at Promise._settlePromise0 (/opt/nativescript-app-sync-server/node_modules/bluebird/js/release/promise.js:614:10)
appsync_1 | at Promise._settlePromises (/opt/nativescript-app-sync-server/node_modules/bluebird/js/release/promise.js:689:18)
appsync_1 | at Async._drainQueue (/opt/nativescript-app-sync-server/node_modules/bluebird/js/release/async.js:133:16)
appsync_1 | at Async._drainQueues (/opt/nativescript-app-sync-server/node_modules/bluebird/js/release/async.js:143:10)
appsync_1 | at Immediate.Async.drainQueues [as _onImmediate] (/opt/nativescript-app-sync-server/node_modules/bluebird/js/release/async.js:17:14)
appsync_1 | at processImmediate (node:internal/timers:464:21) {
appsync_1 | parent: Error: connect ETIMEDOUT
appsync_1 | at Connection._handleTimeoutError (/opt/nativescript-app-sync-server/node_modules/mysql2/lib/connection.js:181:13)
appsync_1 | at listOnTimeout (node:internal/timers:557:17)
appsync_1 | at processTimers (node:internal/timers:500:7) {
appsync_1 | errorno: 'ETIMEDOUT',
appsync_1 | code: 'ETIMEDOUT',
appsync_1 | syscall: 'connect',
appsync_1 | fatal: true
appsync_1 | },
appsync_1 | original: Error: connect ETIMEDOUT
appsync_1 | at Connection._handleTimeoutError (/opt/nativescript-app-sync-server/node_modules/mysql2/lib/connection.js:181:13)
appsync_1 | at listOnTimeout (node:internal/timers:557:17)
appsync_1 | at processTimers (node:internal/timers:500:7) {
appsync_1 | errorno: 'ETIMEDOUT',
appsync_1 | code: 'ETIMEDOUT',
appsync_1 | syscall: 'connect',
appsync_1 | fatal: true
appsync_1 | }
appsync_1 | }
appsync_1 | 2021-03-15T11:16:35: PM2 log: App [nativescript-app-sync-server:1] exited with code [1] via signal [SIGINT]
appsync_1 | 2021-03-15T11:16:35: PM2 log: App [nativescript-app-sync-server:1] starting in -fork mode-
appsync_1 | 2021-03-15T11:16:35: PM2 log: App [nativescript-app-sync-server:1] online
appsync_1 | Mon, 15 Mar 2021 11:16:36 GMT sequelize deprecated The logging-option should be either a function or false. Default: console.log at node_modules/sequelize/lib/sequelize.js:193:13
Did you also change MYSQL_PORT value for appsync service?
https://github.com/mahmoudajawad/nativescript-app-sync-server/blob/master/docker-compose.yml#L46
Hello @mahmoudajawad,
If I have changed that too, I have tried it on my PC in windows and in the ubuntu terminal and I have the same error.
Hi @mahmoudajawad.
I have tried on a clean machine with ubuntu, I have left the default port: 3306 and I have the same error. What operating system are you launching it on?
Can there be a mistake here?:
https://github.com/mahmoudajawad/nativescript-app-sync-server/blob/master/config/config.js#L6-L15
and I think it is this line that breaks everything:
https://github.com/mahmoudajawad/nativescript-app-sync-server/blob/master/models/index.js#L11
Thanks a lot
@vallemar, so this is crazy. I started working on this using podman on fedora, but then continued to work on it using docker on macos, and all the way it was working for me. After your last comment, I tried and attempted to run it on docker on macos only to find that docker is broken for some reason and no matter what I did it refused to work, so I went back to podman on fedora and I could see the same error you reported, so I needed to spend little time on this and finally got it to work, although I was sure it worked for me before.
One thing, I might also need your k8s setup out of this docker-compose, as I want to use it and I'm not sure how I will end-up using it, so having the option for k8s is going to be good.