# Letsencrypt setup does not seem to be able to find its files on first rebuild

**URL:** https://meta.discourse.org/t/letsencrypt-setup-does-not-seem-to-be-able-to-find-its-files-on-first-rebuild/59901
**Category:** Bug
**Created:** [26 במרץ,‏ 2017,‏ 3:11pm UTC](https://meta.discourse.org/t/letsencrypt-setup-does-not-seem-to-be-able-to-find-its-files-on-first-rebuild/59901 "2017-03-26T15:11:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [26 במרץ,‏ 2017,‏ 3:11pm UTC](https://meta.discourse.org/t/letsencrypt-setup-does-not-seem-to-be-able-to-find-its-files-on-first-rebuild/59901/1 "2017-03-26T15:11:57Z")

</div>

I’ve seen this twice about a month ago, and just had it again when I was setting up a brand new forum using the guided `discourse-setup` wizard.

- I started a new digital ocean droplet running ubuntu 16
- I ran the git + docker setup command.
- I ran `apt-get upgrade`
- I made `/var/discourse`
- I cloned in the repo & started `./discourse-setup`
- I entered in proper values for admin email, letsencrypt email, smtp host, username, port, and password.
- I let it rebuild and came back the next morning.
- the site wouldn’t come up so I restarted the ubuntu host
- the site came up, I registered my user, but did not get an email.
- when I checked the logs I saw the problem I’m reporting:

many repeated logs for:

```plaintext
nginx: [emerg] BIO_new_file("/shared/ssl/share.MYDOMAINNAME.com.cer") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/shared/ssl/share.MYDOMAINNAME.com.cer','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: [emerg] BIO_new_file("/shared/ssl/share.MYDOMAINNAME.com.cer") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/shared/ssl/share.MYDOMAINNAME.com.cer','r') error:2006D080:BIO routines:BIO_new_file:no such file)

```

History tells me that if I rebuild the container the error will go away (I assume a symlink is missing, but don’t quite know just why the certificate can’t be found there.

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [26 במרץ,‏ 2017,‏ 3:29pm UTC](https://meta.discourse.org/t/letsencrypt-setup-does-not-seem-to-be-able-to-find-its-files-on-first-rebuild/59901/2 "2017-03-26T15:29:44Z")

</div>

I’m thinking it’s a symlink because this was the solution in the past

[https://meta.discourse.org/t/setting-up-lets-encrypt/40709/216?u=watchmanmonitor](https://meta.discourse.org/t/setting-up-lets-encrypt/40709/216)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [26 במרץ,‏ 2017,‏ 5:45pm UTC](https://meta.discourse.org/t/letsencrypt-setup-does-not-seem-to-be-able-to-find-its-files-on-first-rebuild/59901/3 "2017-03-26T17:45:58Z")

</div>

Hey, @tgxworld. This seems related to [this discussion](https://meta.discourse.org/t/setting-up-lets-encrypt-in-discourse-setup-is-too-fragile/46851/34)

> [@tgxworld](#):
>
> It should work on first run. Might be a recent regression so I’ll need to have a look.

Did you get a chance to have a look yet?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [27 במרץ,‏ 2017,‏ 7:06am UTC](https://meta.discourse.org/t/letsencrypt-setup-does-not-seem-to-be-able-to-find-its-files-on-first-rebuild/59901/4 "2017-03-27T07:06:13Z")

</div>

Well after much head banging because bootstrapping from a fresh install to debug is sooo painfully slow, I found the 🐛 and squashed it in

[https://github.com/discourse/discourse\_docker/commit/659ab19e6fa2c8284a500da810bec00f02e6e2e3](https://github.com/discourse/discourse_docker/commit/659ab19e6fa2c8284a500da810bec00f02e6e2e3)

The web template was still generating a file which was moved into the base image. However, the commands in the file was blowing up because it was trying to `chmod` certain files that would have existed during the first run. As a result, the Let’s Encrypt was not being executed at all during the first run.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [29 במרץ,‏ 2017,‏ 8:37am UTC](https://meta.discourse.org/t/letsencrypt-setup-does-not-seem-to-be-able-to-find-its-files-on-first-rebuild/59901/5 "2017-03-29T08:37:21Z")

</div>

This topic was automatically closed after 2 days. New replies are no longer allowed.
