exoframejs / exoframe

Exoframe is a self-hosted tool that allows simple one-command deployments using Docker
https://exoframejs.github.io/exoframe/
1.13k stars 56 forks source link

Deployment Bug "no such file or directory" #312

Closed gebes closed 2 years ago

gebes commented 2 years ago

Hey there! When deploying to an exoframe server I encounter the following problem

I checked the content of the .exoframe folder in the user home directory. Exoframe generates multiple files and folders, except the deploying folder. I am using the newest version (6.2.0)

$ exoframe list
No deployments found on http://...! (removed the address here)
$ exoframe
Deploying current project to endpoint: http://...
✖ Deployment failed!
Error deploying project: HTTPError: Response code 502 (Bad Gateway)
Build log:

No log available
[exoframe-server] › ℹ  info      Initializing docker services...
[exoframe-server] › ℹ  info      Initializing traefik ...
[exoframe-server] › ℹ  info      Server is running inside docker.
[exoframe-server] › ℹ  info      Traefik instance started ...
[exoframe-server] › ⚠  warning   cors is enabled with config: true
[exoframe-server] › ℹ  info      Server running at: 8080
(node:1) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/root/.exoframe/deploying/root-e25770a0-f149-11eb-8d2a-ddf852ecdeb5/exoframe.json'
    at Object.openSync (fs.js:440:3)
    at Object.readFileSync (fs.js:342:35)
    at module.exports.exports.getProjectConfig (/app/server-core.js:120162:34)
    at deploy (/app/server-core.js:105020:18)
    at Object.handler (/app/server-core.js:105143:7)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:1) 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(). (rejection id: 2)
(node:1) [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.

What is the cause of this problem? Is there anything I can do to fix this?

Thanks!

yamalight commented 2 years ago

@Gebes that's weird. Seems like unpacked project doesn't contain config file for some reason

Some questions about your setup:

  1. Does server has enough disk space?
  2. Does exoframe-server has enough rights to write to mounted config folder?
  3. What command did you use to start exoframe-server?
  4. Have you tried deploying same project locally to see if it works?
gebes commented 2 years ago

Thanks @yamalight for the quick response!

It is working now. I think there was a problem with the config.

I copied this config from an existing installation and modified the values (I replaced the domain with example.com). Then it worked

# whether debug mode is enabled, default "false"
debug: false

# whether to enable letsencrypt, default "false"
letsencrypt: true

# email used for letsencrypt
letsencryptEmail: "office@example.com"
# whether to apply gzip compression, default "true"
compress: true

# whether to execute docker prune for images and volumes, default "false"
autoprune: false

# base top-level domain to use for deployments without domains specified, default "false"
# used as postfix, e.g. if you specify ".example.com" (dot is auto-prepended if not present)
# all your deployments will be autodeployed as "deployment-id.example.com"
baseDomain: "example.com"

# CORS support; can be "true" ("*" header) or object with "origin" property, default "false"
cors: true

# Traefik image to be used; set to "false" to disable traefik management, default "traefik:latest"
traefikImage: 'traefik:latest'

# Traefik container name, default "exoframe-traefik"
traefikName: 'exoframe-traefik'

# Additional Traefik start args, default []
traefikArgs: []

# Network used by traefik to connect services to, default "exoframe"
exoframeNetwork: 'exoframe'

# server image update channel; can be "stable" or "nightly", default "stable"
updateChannel: 'stable'

# path to folder with authorized_keys, default "~/.ssh"
publicKeysPath: '/root/.ssh'

# whether Exoframe server would be running in swarm mode, default "false"
swarm: false

# plugins config
plugins: []

And this is the old one

debug: true

letsencrypt: true

letsencryptEmail: office@example.com

compress: true

autoprune: true

baseDomain: .example.com

cors: true

updateChannel: stable

traefikImage: 'traefik:latest'

traefikName: exoframe-traefik

traefikLabels: {}

traefikDisableGeneratedConfig: false

exoframeNetwork: exoframe

publicKeysPath: /root/.ssh

plugins:

 install: []

I don't know what exactly the problem was. The server has 25GB of disk space available. Exoframe generated all the files and documents in the .exoframe folder, except the deploying folder. Maybe this typo (the dot) was the problem?

baseDomain: .example.com
gebes commented 2 years ago

I found the issue. The endpoint was set to http://example.com and not https://example.com

yamalight commented 2 years ago

That's an interesting issue. I think it should be possible to handle this better in cli 🤔 Will make a ticket to improve the experience, thanks for reporting!