guyzyl / whatsapp-contact-sync

Easy way to sync between the contact photos on WhatsApp to Google Contacts
https://whasync.com/
Other
174 stars 19 forks source link

Fail to start docker container #130

Closed seemebreakthis closed 9 months ago

seemebreakthis commented 10 months ago

After I have built the image (the one that contains both the backend and web), when I try starting it by doing this:

docker run --rm --name whasync -it -p:8081:80 whasync

I see this error:

standard_init_linux.go:230: exec user process caused: no such file or directory

If it helps, I am building my container on a Synology NAS with Intel Celeron J4025.

I have no clue if the server/.env content has anything to do with the problem I am facing. I do the image building after creating the server/.env file and modifying the web/src/pages/GoogleAuth.vue files. And I am wondering if the .env file should have the following content, with no quotes, and nothing else...

GOOGLE_CLIENT_ID=<masked>.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=<masked>-<masked>
guyzyl commented 9 months ago

Do you see this error immediately after starting the container, or when trying to access the server? I just built the image on my MacBook (without any .env files) and it works as expected. This is the output you should be seeing:

Listening on port 8080
Starting Nginx server
seemebreakthis commented 9 months ago

Hi... It finally works now. (and for others who want to run their own docker container for this, please read on, I have some tips).

I was stupidly git cloning in Windows and then copying the files over to my NAS. This lazy way will apparently mess up the files for some reason, causing strange errors when building the docker container. After reading your comment, I went ahead and installed git then did a git clone directly in my NAS. Docker image / container can then be created and started successfully.

But to run it properly, do these things (so here are the tips):

  1. You WILL need to create your own OAuth client id and secret + an API key in https://console.cloud.google.com/apis. Follow the README.md to get started on this.
  2. For the OAuth Client ID, you WILL need to key in the URIs from which you will be accessing the Google APIs. I think this means you'd better have your own domain name to run your docker container web app (luckily I do), and you will need to key in the URIs into the list of "authorized URIs" in order to proceed. I was a little frustrated with why the container kept crashing, so I ended up entering many lines into the list of URIs which is probably an overkill (@guyzyl can probably correct me here with the good list of URIs to be entered):
  1. In the "OAuth Consent Screen", you will need to add your gmail account into the list of test users, or the site will fail to proceed.
  2. You will need to replace the "client ID" (with what you have in OAuth 2.0 client ids) and "API Key" (with what you have in API Keys) in web/src/pages/GoogleAuth.vue after you have cloned the source files, before you start building the image and container.
  3. Up until now I have no clue what the "client secret" does. Apparently even without entering it anywhere in the source code, things will still work.
  4. You WON'T need to create any .env file prior to building the image / container.
  5. You WILL need to enable the "People API" in https://console.cloud.google.com/apis/dashboard. Apparently this API is what the web site calls to insert pictures to your Google contact list.
  6. Do read the docker container "console output" (whatever is displayed after you start running your container) for clues on what issues you might be encountering.
seemebreakthis commented 9 months ago

@guyzyl I will remind myself to click on the "buy me a coffee" icon. Expect that to happen real soon ! Thanks for this.

(any way to make the picture resolution higher... ?) :)

Edit: related to issue #90 . i.e. seems to be out of whasync's control

guyzyl commented 9 months ago

According to your comment https://github.com/guyzyl/whatsapp-contact-sync/issues/90#issuecomment-1817940545 it seems that you managed to find the solution :) And I'm glad you liked the app!