Guide for custom ghost installation?


#1

Hello,

I’m so sure this has been asked so many times before I’m sorry for asking once more but I really cannot find a question answering this:

I see that the official guide for production installation is very opinionated. That’s great, except for that I have an already running server and I’d like to use caddy. Is there absolutely no guide, no matter how open ended (even if it leaves the webserver configuration to me), for installing ghost other than with the prerequisites explained in https://docs.ghost.org/docs/install?

I tried going through with the installation (ghost install) expecting to get some errors (webserver) that I’d fix myself but it doesn’t seem to install anything.

I’m not sure if I should install it as if I were doing it locally?

An alternative from the official docs would be nice. After having used ghost for years it certainly feels like a “fuck you” to have to rely on unofficial docs… :frowning: I’m still quite surprised there’s no alternative so please pardon me if I have missed it on the docs.


Installed ghost with --no-setup-nginx config succesfully, but nothing running on port 2368?
#2

This seems to be your issue - when you run ghost install, it should ask you a series of questions which you fill out. If it’s not doing that, something’s not working properly.

While the CLI is really opinionated (for good reason), it does support you telling it to do something another way, or not doing it at all - docs ref


#3

I found this after a quick search on Google, maybe it helps:


#4

Hi, thank you,

when I run ghost install it runs some checks of which the nginx one fails. It asks me if I want to go on with the installation, either by saying yes or no, it starts trying to isntall it but it returns the error “Checking operating system compatibility” “System stack checks failed with message: ‘Missing package(s): nginx’”. And stops. The folder is empty.

Thanks for the links, it looks like I might be able to install it using the setup options. However, at first sight, I’m still not sure of which command will install the ghost files on my server, it looks like all those setup commans are focused on the specific configs with the database, the webserver, etc…

Thanks :slight_smile:


#5

thank you :P, I obviously went through that post before coming here, and besides it’s not official, it uses docker so it seems to download the ghost files from some specific docker with

docker run --env NODE_ENV=development --name ghost -p 8080:2368 -v /home/USERNAME/data/ghost:/var/lib/ghost ghost:latest

It sounds dumb but I have no problem setting up caddy, it’s just that I don’t know where am I supposed to get the ghost files from! Maybe I just need to clone the project from github heheh :stuck_out_tongue:

I kind of asked here as feedback on the fact that it can be a bit confusing how to proceed if you don’t go with the specific requisites hehe

thanks though :stuck_out_tongue:


#6

try ghost install --no-setup-nginx

ghost install runs ghost setup in the background! So you want to use ghost install, but you can pass ghost setup flags if that makes sense


#7

I managed to install ghost now. In theory it’s running at 127.0.0.1:2368 but if I set caddy to reverse proxy to that, when accessing my domain I get a “Cannot GET /” Error. From ghost ls I take it that the cli makes it run in the background and so I don’t need to use pm2/forever anymore… got any clues of what might be wrong? It’s funny that the whole setup thing is supposed to make it easier…it’s making it 10x more complex to me haha


#8

:tada:

That’s correct! The CLI is pluggable, so if you find an extension for a process manager, you can use it, but the default is systemd integration

Hmm, can you run curl http://127.0.0.1:2368 -I to make sure the Ghost instance is responding? If it works, then there’s an issue with your caddy config, and I’m not well-versed in caddy, so I can’t help :grimacing:

Hopefully you’ll find the update process to be 10x easier :laughing: The CLI works well, but it is definitely a WIP :slight_smile:

Edit: you don’t necessarily need to use curl to make sure your instance is up, but I suggested it because it ensures that the entire chain of events is functional. You can also use netstat (sudo netstat -tulnp) to make sure ghost is active and listening on the correct port.


Installed ghost with --no-setup-nginx config succesfully, but nothing running on port 2368?
#9

So I installed ghost with --no-setup-nginx since I want to use caddy.

If I run ghost ls, I see ghost is running on port 2368.

I configured caddy, and when accessing my domain I get a “Cannot GET /”. When I run a “lsof -i :2368” on my server, nothing appears. Does this mean ghost is not running on the port it says it’s running?

How can I troubleshoot what’s going on?


#10

Hey :wave: I didn’t realize you posted a new topic - I already responded in the other one you created.

I don’t think lsof will list ports that have proceesses bound to them. I edited my reply (Guide for custom ghost installation?) to give you more info :+1:


#11

Sorry that I opened a new thread, I thought that since it was a different issue, it’d be good to have it separately for the post db :stuck_out_tongue:

I tried sudo netstat -tulnp and it lists all my node apps but not ghost.

I also tried curl http://127.0.0.1:2368 -I this is the output

I’m quite sure that caddy is working right since I tried the configuration with another app, I am basically pointing https://blog.everyday.app to 127.0.0.1:2368 with it. I’m not sure what may be wrong, I installed “n” to be able to install node 6.9.0 for ghost, and so I reinstalled node 10.6.0 with n for my other apps, I’m not sure if this could be adding confusion to the ghost cli?

Thanks for the patience and help Vikas :slight_smile:


#12

just to prove that ghost says it’s running this is the output of a ghost ls:

(had to put it in a different answer since I’m a new user, sorry)


#13

Just ran some tests on one of my production instances - did you configure your blog to run on a subdirectory? i.e. my.blog/SUBDIR? The instance I tested with returns the same response (headers + 404) when requesting /, but returns the proper headers when requesting /blog, since it’s configured to run on a subdirectory.

Edit: I forgot ghost ls outputs the url - could you try restarting ghost (ghost restart) to see if that helps?


#14

I just tried https://blog.everyday.app/blog/ and you are right, it works under /blog. However, I didn’t configure this hmm at least knowingly.

My config.production.json looks like:

{
  "url": "https://blog.everyday.app",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "not_the_real_user",
      "password": "not_the_real_pw",
      "database": "ghost_prod"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/ghost/content"
  }
}

and even though you are not familiar with caddy I just show the config to show that I don’t specify /blog everywhere:

blog.everyday.app {
  timeouts none
  proxy / localhost:2368 {
    transparent
  }
  log /var/log/caddy/blog-everyday-app-caddy-access.log
  errors /var/log/caddy/blog-everyday-app-caddy-errors.log
  tls my_email@gmail.com
  header / Strict-Transport-Security "max-age=31536000;"
}

Thanks again for the patience. Do you know where could I check why node is serving it at /blog ?


#15

I uninstalled ghost and started the whole process from 0 (now that I had learnt a few things) and it worked straight away. Thanks for all the help Vikas! Might write a blog post to help future users :slight_smile:


#16

If anyone is looking to run Ghost in a Docker container, here is the setup I use in production. Just execute runup.sh bash script and you are good to go. This setup also allows you to run your blog under mysite.com/blog.

Ensure you have Docker installed on your server. To update your Ghost container, just stop the container and execute to runup.sh again. Hope it helps :slight_smile:

Cheers :fire::newspaper: