{"id":1444,"date":"2023-04-10T20:11:12","date_gmt":"2023-04-11T01:11:12","guid":{"rendered":"https:\/\/zewwy.ca\/?p=1444"},"modified":"2023-04-10T20:11:12","modified_gmt":"2023-04-11T01:11:12","slug":"fixing-vaultwarden-502-bad-gateway","status":"publish","type":"post","link":"https:\/\/zewwy.ca\/index.php\/2023\/04\/10\/fixing-vaultwarden-502-bad-gateway\/","title":{"rendered":"Fixing Vaultwarden 502 Bad Gateway"},"content":{"rendered":"<p>So anyway, the other day I updated the base OS for the instance of <a href=\"https:\/\/github.com\/dani-garcia\/vaultwarden\">Vaultwarden<\/a> I&#8217;m running. If you are interested in setting up your own you can follow <a href=\"http:\/\/zewwy.ca\/index.php\/2019\/10\/04\/bitwardenrs-install\/\">this old guide<\/a>, however you&#8217;ll have to note the YML config differences as noted in my other <a href=\"http:\/\/zewwy.ca\/index.php\/2021\/05\/31\/bitwardenrs-upgrade-to-vaultwarden\/\">post upgrading to Vaultwarden<\/a>, and this post.<\/p>\n<p>It&#8217;s running on Ubuntu which was easy enough to update to the latest release build.<\/p>\n<pre>apt update\r\napt upgrade\r\nreboot\r\ndo-release-upgrade<\/pre>\n<p>Simple enough, and everything went to plan. I made backups along each step too. The service was up, and life was good after a full complete system upgrade. Yay&#8230; or so I thought&#8230;. until I went to bring up a instance of pihole via docker compose and it errored out on me. When I looked up the error it seemed to be related to python.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/QpFk3rA.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/QpFk3rA.png\" alt=\"\" width=\"761\" height=\"402\" \/><\/a><\/p>\n<p>So, I figured I&#8217;d install it, or try to?<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/pI7fTlQ.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/pI7fTlQ.png\" alt=\"\" width=\"699\" height=\"171\" \/><\/a><\/p>\n<p>Da faq? I remember this python\/pip stuff being a pain intially too, what did I run again?<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/PETLWdb.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/PETLWdb.png\" alt=\"\" width=\"351\" height=\"276\" \/><\/a><\/p>\n<p>OK, maybe need to get the newer stuff? Old one no good?<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/dJygAlS.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/dJygAlS.png\" alt=\"\" width=\"368\" height=\"357\" \/><\/a><\/p>\n<p>Not now Kaa!!! let&#8217;s see&#8230;<\/p>\n<pre>apt install python3-pip<\/pre>\n<p><a href=\"https:\/\/i.imgur.com\/u9nhc1j.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/u9nhc1j.png\" alt=\"\" width=\"845\" height=\"245\" \/><\/a><\/p>\n<p>and&#8230;<\/p>\n<pre>pip install docker-compose<\/pre>\n<p>Looks like the command is working again. \ud83d\ude42<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/9IXtRr7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/9IXtRr7.png\" alt=\"\" width=\"413\" height=\"305\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i.imgur.com\/ekDu4kw.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/ekDu4kw.png\" alt=\"\" width=\"574\" height=\"122\" \/><\/a><\/p>\n<p>But after pulling the latest build, and bringing it back up, there were no errors return to the command, but when I tried to access the service all I got was a 502 Gad Gateway from the loadbalancer. Since I knew it lived outside the container and was unaltered that it most likely was not the culprit, I ask on the #nginx channel and was told to check the container status with:<\/p>\n<pre>docker ps<\/pre>\n<p><a href=\"https:\/\/i.imgur.com\/JPNhGg0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/JPNhGg0.png\" alt=\"\" width=\"855\" height=\"42\" \/><\/a><\/p>\n<p>OK, but why? then another helpful hint by a user:<\/p>\n<pre>docker-compose logs -f<\/pre>\n<p><a href=\"https:\/\/i.imgur.com\/Vb8s8W4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/Vb8s8W4.png\" alt=\"\" width=\"765\" height=\"228\" \/><\/a><\/p>\n<p>This is when things get a bit weird\/funny. <a href=\"https:\/\/github.com\/dani-garcia\/vaultwarden\/issues\/2741\">I found this post about the SMTP Depreciated Warning<\/a>, which stated that had nothing to do with the service not coming up. Which then linked to this <a href=\"https:\/\/github.com\/dani-garcia\/vaultwarden\/discussions\/2485\">issue post more likely to be the cause<\/a>.<\/p>\n<p>So, I kept trying, the log wouldn&#8217;t change from the snip above, I thought for sure, it has to be this &#8220;Rocket Address&#8221;, surely. I just wasn&#8217;t sure what .env was in that issue&#8217;s context. Another helpful hint from IRC:<\/p>\n<pre>docker inspect bitwardenzewwyca_app_1<\/pre>\n<p>When looking at it was already defined as 0.0.0.0.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/fp08QcM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/fp08QcM.png\" alt=\"\" width=\"577\" height=\"74\" \/><\/a><\/p>\n<p><a href=\"https:\/\/vaultwarden.discourse.group\/t\/vaultwarden-no-longer-works-gives-502-bad-gateway\/1654\">This post, same exact problem, saying the exact same thing,<\/a> but I don&#8217;t know what env.sh is in their context either, slowly losing hope, despair ensues.<\/p>\n<p>I even try changing the log location, create a file, with cmod 777 on it:<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/GTlO1tP.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/GTlO1tP.png\" alt=\"\" width=\"804\" height=\"270\" \/><\/a><\/p>\n<p>Dang it! But this is when things take a strange turn&#8230;. I decided even though the SMTP_SSL wasn&#8217;t the root cause to change it anyway as it suggests:<\/p>\n<p>changed SMTP_SSL=false to SMTP_SECURITY=false<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/4qodTLj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/4qodTLj.png\" alt=\"\" width=\"852\" height=\"459\" \/><\/a><\/p>\n<p>Well, it finally shut up about the depreciated setting, but same dang issue, can I just get rid of the log file option? (since it&#8217;s just in the yml config file anyway&#8230;) Get rid of the log file entry in the YML file, and then&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/SCKDzAf.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/SCKDzAf.png\" alt=\"\" width=\"799\" height=\"204\" \/><\/a><\/p>\n<p>Woah a different error message, wait the option is important, and I marked it wrong, ok final changed<\/p>\n<p>changed SMTP_Security=false to SMTP_SECURITY=off.<\/p>\n<p>bring down and up the container and&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/tXoeL3Z.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/tXoeL3Z.png\" alt=\"\" width=\"849\" height=\"338\" \/><\/a><\/p>\n<p>Ehhhhhhhhh! My Vaultwardens back! Time to see if I can bring up ze PiHole!<\/p>\n<p>I hope this post helps someone in the same boat.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So anyway, the other day I updated the base OS for the instance of Vaultwarden I&#8217;m running. If you are interested in setting up your own you can follow this old guide, however you&#8217;ll have to note the YML config differences as noted in my other post upgrading to Vaultwarden, and this post. It&#8217;s running &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zewwy.ca\/index.php\/2023\/04\/10\/fixing-vaultwarden-502-bad-gateway\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Fixing Vaultwarden 502 Bad Gateway&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","footnotes":""},"categories":[8],"tags":[355],"class_list":["post-1444","post","type-post","status-publish","format-standard","hentry","category-server-administration","tag-vaultwarden"],"_links":{"self":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/1444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/comments?post=1444"}],"version-history":[{"count":1,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/1444\/revisions"}],"predecessor-version":[{"id":1445,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/1444\/revisions\/1445"}],"wp:attachment":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/media?parent=1444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/categories?post=1444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/tags?post=1444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}