Starting the server on ubuntu ec2 instance

I have a couple of questions a new user. I understand, I’ve tried Googling but couldn’t find anything concrete. Here it goes.

  1. How do you actually run the server in real world. I could do “hugo server” but how do I make sure its working after I disconnect the SSH session? I could use something like supervisord to make sure its always running but whats the recommended way?

  2. I changed the “baseURL” in my config.toml but it isn’t actually reflecting. The “inspect source code” suggests that its still linking to localhost. UNLESS, I specifically use “–baseURL” argument while starting the server. This is the command that I use right now, please suggest a better approach.

hugo server -D --bind=0.0.0.0 --port=80 --baseURL=http://xx.xx.xx.xx/

where xx.xx.xx.xx = my server’s external IP.

Thanks!

Update, I just read about “hugo” command generating the static site that can be served with any web server like apache nginx etc. I guess that would also take care of rendering the actual “baseURL” that i put inside the config.toml?

The short answer is: Yes.

The Hugo server is primarily meant for local development. If you really want to use it the way you describe, you need to start it with the --baseURL flag set.

@bep yeah, I think that clarifies it. I am only supposed to deploy the public directory thats generated by the local development.

Which leads to one more question, if you will.

How d opeople usually have some sort of continuous integration? The docs suggest that you want to manually remove the “public” directory before you re-generate your static site every single time. So do people just push their public to git and clone from there or how?

I don’t think that is a common approach.

The common pattern is to put public/ in .gitignore and then set up some CI server to build on commit.

With the “some CI” server there are lots of options: Circle CI, Travis …

There are also lots of tools to do the actual deployment, depending on how you host, including hugo deploy.

@bep wouldn’t any CI tool, be it jenkins, travis depend on the files being available within the git repository so it can push the files from there to the actual server?

The SOURCE FILES, yes.