Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

certificate signed by unknown authority bug when self-hosting hugoDocs #4

Closed
jmarca opened this issue Oct 16, 2018 · 2 comments
Closed

Comments

@jmarca
Copy link

jmarca commented Oct 16, 2018

I spent a few days trying to get hugo with extensions to compile and run in alpine linux...but finally gave up (would get periodic segfaults!! but sometimes it ran okay). Your docker builds solve that problem, (I'm guessing that's the reason for the FROM frolvlad/alpine-glibc:alpine-3.7?) so thanks, and great work.

However, I just came across a bug trying to self-host the hugoDocs website.

To reproduce, clone the hugoDocs site, then do:

james at laptop in ~/repos/hugo_related/hugo/hugoDocs on master
$ docker run --rm -it -v $(pwd):/src -v $(pwd)/public:/target --name hugodocs -p 1314:1313 klakegg/hugo:0.49-ext-pandoc server 
Building sites … ERROR 2018/10/16 16:03:53 Failed to get JSON resource https://api.twitter.com/1/statuses/oembed.json?id=962380712027590657&dnt=false: Get https://api.twitter.com/1/statuses/oembed.json?id=962380712027590657&dnt=false: x509: certificate signed by unknown authority
...

(ah, note that I'm exposing 1313 to 1314 externally because I'm running my dev blog on 1313...)

To solve, I copied your alpine ext Dockerfile and then added

RUN apk add --no-cache libstdc++ \
	ca-certificates

With that change, hosting the hugoDocs website works:

james at laptop in ~/repos/hugo_related/hugo/hugoDocs on master
$ docker run --rm -it  -e HUGO_BIND="0.0.0.0"  -e HUGO_PUBLISHDIR=/target   --user 1000 -p 1314:1313  -v ${PWD}:/home  --name hugodocs  -v ${PWD}/public:/target  jmarca/hugo server

                   | EN  | ZH   
+------------------+-----+-----+
  Pages            | 540 |  23  
  Paginator pages  |   1 |   0  
  Non-page files   |  41 |   0  
  Static files     | 166 | 166  
  Processed images |  90 |   0  
  Aliases          |  15 |   4  
  Sitemaps         |   2 |   1  
  Cleaned          |   0 |   0  

Total in 1193 ms
Watching for changes in /home/{content,data,layouts,static,themes}
Watching for config changes in /home/config.toml
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

I think this will have to be done in the final images in your setup, since the ca-certs might be different in busybox/alpine/ubuntu/etc. So no pull request from me, as it seems like something for you to decide where to put it best.

(I also fiddled with a few other things in the Dockerfile, which is why the source is /home, --user is 1000, etc...but those aren't bugs)

@klakegg
Copy link
Owner

klakegg commented Oct 16, 2018

Thank you very much for your feedback. I was able to reproduce the errors using all images based upon Alpine and Busybox. I've made some changes and triggered build of version 0.49.1.

Could you please verify the new 0.49.1 image(s) fixes your problem so I can move on to images with 0.49.2?

I'm happy to see you are making use of the image(s) according to your needs, which is very much in line with my intention.

@jmarca
Copy link
Author

jmarca commented Oct 16, 2018

yes it works for me. Output:

$ docker run --rm -v $(pwd)/:/src -v $(pwd)/public:/target -e "HUGO_ENV=production" klakegg/hugo:0.49.1-ext server

                   | EN  | ZH   
+------------------+-----+-----+
  Pages            | 540 |  23  
  Paginator pages  |   1 |   0  
  Non-page files   |  41 |   0  
  Static files     | 166 | 166  
  Processed images |  90 |   0  
  Aliases          |  15 |   4  
  Sitemaps         |   2 |   1  
  Cleaned          |   0 |   0  

Total in 1380 ms
Watching for changes in /src/{content,data,layouts,static,themes}
Watching for config changes in /src/config.toml
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 0.0.0.0)
Press Ctrl+C to stop

@jmarca jmarca closed this as completed Oct 16, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants