#Unable to connect Github repo

79 messages · Page 1 of 1 (latest)

pulsar hull
#

I followed the guide to setup github app, but after I tried connecting repo I get an error above after github calls back. Development error might indicate something with oauth. Any hints?

pulsar hull
#

official in docs

bold quest
#

Do you can send the link of the specific tutorial that you have followed?

#

Also, what are the logs for docker compose logs appwrite?

pulsar hull
bold quest
pulsar hull
#

Master pid 1, manager pid 7
[Error] Timestamp: 2024-05-31T17:12:04+00:00
[Error] Method: GET
[Error] URL: /v1/vcs/github/callback
[Error] Type: Ahc\Jwt\JWTException
[Error] Message: Signing key cannot be empty
[Error] File: /usr/src/code/vendor/adhocore/jwt/src/ValidatesJWT.php
[Error] Line: 34
[Error] Timestamp: 2024-05-31T17:18:07+00:00
[Error] Method:
[Error] URL: /favicon.ico
[Error] Type: Appwrite\Extend\Exception
[Error] Message: The requested route was not found. Please refer to the API docs and try again.
[Error] File: /usr/src/code/app/controllers/general.php
[Error] Line: 972

#

oh

#

where do I set this signing key?

bold quest
pulsar hull
#

_APP_VCS_GITHUB_CLIENT_SECRET is set

#

_APP_VCS_GITHUB_WEBHOOK_SECRET set as well

#

_APP_OPENSSL_KEY_V1 too

bold quest
#

According to the page in the link you sent there are more variables that need to be set

#

Specifically those:

#

_APP_VCS_GITHUB_APP_NAME
_APP_VCS_GITHUB_PRIVATE_KEY
_APP_VCS_GITHUB_APP_ID
_APP_VCS_GITHUB_CLIENT_ID
_APP_VCS_GITHUB_WEBHOOK_SECRET

pulsar hull
#

all set

bold quest
# pulsar hull all set

If you have installed appwrite through the usual procedure (the automatic install in the docs), do you have run this command to recreate the containers and apply the changes?
docker compose up -d

pulsar hull
#

yup

bold quest
# pulsar hull yup

Weird. After runnng docker exec appwrite vars does it shows all the github keys?
(**don't **send here the keys)

pulsar hull
#

yes, 6 in total

#

those you listed and app id additional

pulsar hull
bold quest
pulsar hull
#

yeah, I didn't fix it yet, but the solution was in the link, I must have had folded it wrong

#

thanks for all the help!

bold quest
lapis gulch
pulsar hull
#

this env var should probably be just path to the mounted file instead of value

pulsar hull
#

oh, or even better compromise, provide an example of properly folded key

pulsar hull
#

@bold quest I've regenerated private key in github app and used the command provided by @lapis gulch to create the variable and updated containers

#

using the script provided in appwrite discussion I get Invalid Private Key

#

version 1.5.7

#

removing newline character at the end produces same error

#

@icy tartan maybe you'll find it interesting

icy tartan
lapis gulch
#

@pulsar hull so you didn't managed to solve it as well? I'm also still having the issue.
@icy tartan I've changed the env and restarted the container

pulsar hull
#

portainer > update the stack with prune services

icy tartan
icy tartan
icy tartan
lapis gulch
pulsar hull
#

environment variables, advanced mode in portainer

icy tartan
pulsar hull
#

echo $_APP_VCS_GITHUB_PRIVATE_KEY from inside container shows updated var

icy tartan
pulsar hull
#

yeah, not in prod yet

lapis gulch
#

@pulsar hull i've just noticed the cmd i've posted creates \n\n instead of \n. better check it as well.

pulsar hull
#

not on mac, it's creating single newline

lapis gulch
#

i did it on mac as well

icy tartan
pulsar hull
#

and env_var parameter doesn't work in portainer either, imho it looks for it inside portainer container...

pulsar hull
#

env_file in docker compose, sorry for the confusion

#

I'll notify here of the results

icy tartan
pulsar hull
#

yup

#

probably not necessary

icy tartan
# pulsar hull yup

Interesting...maybe portainer isn't using the compose commands 🤷‍♂️

icy tartan
pulsar hull
#

seems like it, it even seems to parse compose definition it's own way, because swarm mode errored about container_name

icy tartan
pulsar hull
#

fyi, env_file is also not supported in swarm mode, just as well as reading .env from the same folder

#

that's the correct way to deploy: export $(cat standard/appwrite/.env) > /dev/null 2>&1; docker stack deploy appwrite -c standard/appwrite/docker-compose.yaml

#

to read variables from .env

#

but having variable set in .env like in the screenshot, get's me all the same error as before

#

so there is definitely something missing from the docs on how to properly format this variable

#

my docker-compose starts like this:

version: '3'
services:
  appwrite:
    image: appwrite/appwrite:1.5.7
    networks:
      - appwrite
      - traefik
    deploy:
      labels:
        - traefik.enable=true
        - traefik.http.services.appwrite_api.loadbalancer.server.port=80
        #http
        - traefik.http.routers.appwrite_api_http.entrypoints=web
        - traefik.http.routers.appwrite_api_http.rule=Host(`domain.com`) && PathPrefix(`/`)
        - traefik.http.routers.appwrite_api_http.service=appwrite_api
        # https
        - traefik.http.routers.appwrite_api_https.entrypoints=websecure
        - traefik.http.routers.appwrite_api_https.rule=Host(`domain.com`) && PathPrefix(`/`)
        - traefik.http.routers.appwrite_api_https.service=appwrite_api
        - traefik.http.routers.appwrite_api_https.tls=true
        - traefik.http.routers.appwrite_api_https.tls.certresolver=production
      mode: replicated
      replicas: 1
      update_config:
        parallelism: 1
        delay: 30s
      restart_policy:
        condition: on-failure
      placement:
        constraints:
          - node.role == manager
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - /home/debian/standard/appwrite/uploads:/storage/uploads:rw
      - /home/debian/performance/appwrite/cache:/storage/cache:rw
      - /home/debian/standard/appwrite/config:/storage/config:rw
      - /home/debian/standard/appwrite/certificates:/storage/certificates:rw
      - /home/debian/performance/appwrite/functions:/storage/functions:rw
    depends_on:
      - redis
      - clamav
    environment:
      - _APP_ENV
      - _APP_WORKER_PER_CORE
      - _APP_LOCALE
      - _APP_CONSOLE_WHITELIST_ROOT
      - _APP_CONSOLE_WHITELIST_EMAILS
      - _APP_CONSOLE_WHITELIST_IPS
      - _APP_CONSOLE_HOSTNAMES
      - _APP_SYSTEM_EMAIL_NAME
      - _APP_SYSTEM_EMAIL_ADDRESS
      - _APP_SYSTEM_SECURITY_EMAIL_ADDRESS
      - _APP_SYSTEM_RESPONSE_FORMAT
#

every service is configured like this, very similar

#

even more interesting, the command I pasted before is cutting variable out at space character and that's why it fails this time

#

@lapis gulch I got it working, here is the steps I took:

  • on my mac: awk -v ORS='\n' '1' private-key.pem | pbcopy
  • on my vm: export _APP_VCS_GITHUB_PRIVATE_KEY="<paste it here as is, no modifications, it should be multiline before you hit enter>"
  • deploy stack without reading .env again, because it'll override
#

@bold quest @icy tartan thanks a lot for help in here, I really appreciate it

here is the takeaway, I don't know how you test it locally, what tools you use and how you deploy to prod, but \n can't be written as literal string in the variable, because it won't render, it needs to be corrected in the docs or update the script to render newline characters like that

also any IDE, text area or even nano is rendering pasted variable as multiline destroying the .env file which is by default an ini file

the only working solution is to export this variable in the shell which makes deployment command kind of a monster like 😄

#

a fix would be to allow users to provide a path to a file that they can mount in the container

#

example of deployment command:

export $(cat standard/appwrite/.env) > /dev/null 2>&1; _APP_VCS_GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
....
-----END RSA PRIVATE KEY-----
"; docker stack deploy appwrite -c standard/appwrite/docker-compose.yaml
icy tartan