Eagles-DevOps / MiniTwit

2 stars 1 forks source link

Deployed apps are failing #106

Closed Romes8 closed 7 months ago

Romes8 commented 7 months ago

When we deploy app into droplet after some amount of time if crashes.

I think its because the simulation is making requests. At some point there is an error which I guess makes the app fail.

danielgron commented 7 months ago

Can someone try to start it and direct Std output to a text file? Ie ./Minitwit > log txt ?

I can't remember what the app is called on the server but something to that effect...

danielgron commented 7 months ago

I'm not on my laptop for another few hours, so if someone else is able to try that would be great.

Hopeberg commented 7 months ago

I tested by creating two droplets, and as soon as I close the console they run in, the app can no longer be accessed.

rasmus-bn commented 7 months ago

I think if we add "&" after the run command that should start the app as a new process (different from the process running from ssh connection). Will try this

Hopeberg commented 7 months ago

cool, let us know how it goes

danielgron commented 7 months ago

Oh Yeah if it is running straight in the ssh that's a problem. Are you sure we want ampersand and not nohup?

rasmus-bn commented 7 months ago

cool, let us know how it goes

I am not completely sure how to reproduce this issue as I don't know the steps that you took.

Oh Yeah if it is running straight in the ssh that's a problem. Are you sure we want ampersand and not nohup?

Yeah that is propably better. (reference)

Hopeberg commented 7 months ago

I am working from branch dploy. I set my secrets in GitHub (docker_username, docker_password, do_token, ssh_key_name). Upon push to the branch, the action will create 2 new droplets with terraform. Then you need to manually install go and clone the repo and run the go files. You do this inside the droplet consoles, and they send you a password on email to access the console of each droplet.

Hopeberg commented 7 months ago

Try to reproduce the steps, or I can demonstrate what happens if you got time for a call today. I don't think our server is persistent.... Not from what I have tested. The consoles were running last night, and when I woke up today, the apps are down again. I had to run the go files once again inside of the consoles for the app to be accessible.

Hopeberg commented 7 months ago

In addition, the API failed this morning with the following error : "all authentication methods failed", despite being up and running yesterday. So I have decided to run two new droplets now...

Hopeberg commented 7 months ago

For the API console, after cloning the repo, switch to branch dploy to run the minitwit-api.go. I fixed an error in the format of a go version in a mod file (error currently in main). If you don't switch the branch, it will not run the file.

Hopeberg commented 7 months ago

Thanks for the tips, I tried running these commands on the consoles and it worked:

nohup go run minitwit.go & nohup go run minitwit-api.go &

I expect this to solve the issue with foreground jobs/ non persistent server.

The API always shows 404 page not found, because we have no UI.

Hopeberg commented 7 months ago

When I come back from a meeting, I'll spin up our team droplets and make them a background job. Hopefully will solve the issue

Hopeberg commented 7 months ago

the background jobs are working, and I can now close the console and app are still accessible. Hoever, main app does not load correct - not sure why?

Skærmbillede 2024-02-28 kl  14 25 23
Romes8 commented 7 months ago

@Hopeberg would it be possible to merge your dploy branch into CI/CD-Pipeline so we are know where are the related changes to this issue.

Romes8 commented 7 months ago

the background jobs are working, and I can now close the console and app are still accessible. Hoever, main app does not load correct - not sure why? Skærmbillede 2024-02-28 kl 14 25 23

Images are visible for me on the sire. Can somebody check and see how it is for them ? @everyone

Hopeberg commented 7 months ago

Issue is fixed with commands for background jobs making the apps persistent