Activate New Deployment port problem

Hi guys,

I get:
Activate New Deployment 20210818090721
Activated /home/cleavr/api.lsvab.se/releases/20210818090721
Reloading api.lsvab.se…
Creating ecosystem file
Ecosystem file is not linked. Linking…
[PM2][ERROR] File /home/cleavr/api.lsvab.se/current/.cleavr.config.js malformated
/home/cleavr/api.lsvab.se/.cleavr.config.js:11
“PORT”: ,
^

SyntaxError: Unexpected token ‘,’

When i try to deploy. I looks like the port number is missing.

Any idea how to solve?

I tried to use V.2.0 and i got success on deploy but then 502 due to this error.
V.2.0 did not abort deploy and broke the app.

Hey Peter,

The last completed deployment was via 2.0? It seems like it worked then since I can see the api.

502’s can show even if the rest of the deployment is successful. Usually 502’s are due to PM2 just needing a refresh, app can’t connect to db, app has a hardcoded port that differs from the one assigned in Cleavr that PM2 is attempting to use, etc. https://docs.cleavr.io/nodejs-deployments

It does appear the PM2 config file we generate on the fly during deployments is missing the port number in 1.0. We’ll take a look into that to see if we can find what’s going on.

Hi man,
Well the last deployment was made with v1 and it reverted to the old deploy due to the error.

I have seen this problem on other apps with exact same structure. The v1 worked but i got error on v2.

If i trye v2 i get the error and the app doesn’t revert to the last working deploy as v1 do.

I notised that there are som new stuff in v2 under Build PM2 Ecosystem that i don’t have in v1.

Could this have anything to do with my problem?

That shouldn’t be an issue - v2 also shows the PM2 script in case you’d want to make some customizations. But, the v2 script looks fine.

Was the web app created in v2 and then deployed in v1?

There is one possible fix we thought of. I’m testing it real quick and will let you know when it’s ready.

Oups, i might have missunderstod this. My apps are all created in v1 but logging in to v2 they were all there so i just tried to deploy.

Must i recreate all servers and apps in v2?

So far i don’t see any reason to stick with v1 so maybe i need to click the “Ready to make the switch?” and things will be done to my servers and apps to work in v2?

Gah.

Now i have messed up totally. I get:

"proxy_cache_key" directive is duplicate in /etc/nginx/conf.d/nginx_proxy_cache.conf:1

and can’t start Nginx.

I think me jumping between v1 and v2 has broken something.

I really need to get this app working again.

Hello Peter,

You don’t need to recreate all the servers and apps in Cleavr 2.0. You can click on the Learn more button on the top banner and then click on Switch so that we can make your servers and apps operational in the new Cleavr environment.

Step 1

Step 2
image

Thank you.

Tank you,
now i have switched to v2 and will not mess with v1 anymore.

Still having problem with Ngionx not starting and deployment looks better. I get the port in config file and success message but still 502 error.

Hello Peter,

Right now we are looking into your issue and get back to you as soon as possible.

Hello Peter,

We are still digging on why it happened but have fixed the issue for you. Let us know if the issue still persists or if you face any other issues.

Thank you.

Thank you,
now the deployment works fine but for some reason i still get 502.

I have checked all settings and env data but can’t find anything wrong.

I have two exact same apps but they are live and i dont want to touch them if something brakes.

But if you want to compare them you can look at the other api.xxxx.xx apps.

Maybe you will see something i have missed,

Now i notised that both .cleavr.config.js and .env has different permissions than the workin apps.

I hope this could be the reason for my 502.
Maybe the .env is not readable and there for the DB cant connect?

This is from the Nginx error log:

2021/08/20 09:30:13 [error] 5752#5752: *1902 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: api.lsvab.se, request: "GET /favicon.ico HTTP/2.0", upstream: "http://127.0.0.1:7545/favicon.ico", host: "api.lsvab.se", referrer: "https://api.lsvab.se/"

It looks to me as if it has nothing to do with the DB connection?

God i love you guys, it’s working now.

Just curious what the problem was :slight_smile:

3 Likes

Hello Peter,

Your love for Cleavr is what motivates us. And we apologise for the inconvenience caused.

The issue was that the .env was not being linked. Env linking is a part of Build Assets hook and it was disabled so we added a new env link hook for you.

W̶e̶ ̶w̶i̶l̶l̶ ̶b̶e̶ ̶a̶d̶d̶i̶n̶g̶ ̶a̶ ̶p̶r̶o̶p̶e̶r̶ ̶a̶n̶d̶ ̶c̶l̶e̶a̶r̶ ̶d̶e̶s̶c̶r̶i̶p̶t̶i̶o̶n̶ ̶t̶o̶ ̶a̶l̶l̶ ̶t̶h̶e̶ ̶h̶o̶o̶k̶s̶ ̶s̶o̶o̶n̶.̶ We have added proper instructions for some of the hooks. :wink:

Thank you.

3 Likes

Great work.

So, do i need to ad this hook to my other apps?

Yes, if you intend to disable Build Assets hook since linking env is a part of Build assets hook.

Fantastic.

Thank you :slight_smile:

1 Like