webprogramming260 / .github

Web Programming 260 Instruction
MIT License
23 stars 127 forks source link

Update simon-db.md #35

Closed Jtrom314 closed 1 year ago

Jtrom314 commented 1 year ago

Hi Professor Jensen,

I had a problem with getting access to my Mongo DB on my startup and simon server. After working with a TA, we came up with the following solution. I don't know if it belongs here but I think it could help others if they had the same problem that I did

Jtrom314 commented 1 year ago

Yeah,

I did have the database working weeks ago, however, when I pushed my startup to the server, it somehow reverted those changes that we made together and the server changed the environment variables to be the one that you had set. (ie, I was getting your data again both in simon and in the startup).

I think it was PM2 because the server connection worked on both my local machine and on the web server when I stopped PM2 and ran node index.js on the service (while ssh'ed on the server)

We tried restarting the service but for some reason it only worked when we essentially deleted the service from PM2 and put it back on and re-assigning the port

I hope that made sense. I can come into office hours on Monday and talk about it some more with you if needed.

Jacob

On Wed, Mar 15, 2023 at 6:56 PM Lee S Jensen @.***> wrote:

@.**** commented on this pull request.

Hum, that seems like a pretty heavy hammer. Do you know what was actually the problem? Was it really PM2, or was it restarting the service that fixed the problem? You did several things there, including updating the running process to reset their environment. I thought you had your database running several weeks ago.

— Reply to this email directly, view it on GitHub https://github.com/webprogramming260/.github/pull/35#pullrequestreview-1342696344, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXIHDZ6RLNO3VUXZPDGSZDTW4JQMLANCNFSM6AAAAAAV4GBTMQ . You are receiving this because you authored the thread.Message ID: @.***>

leesjensen commented 1 year ago

I'm guessing the problem was that we didn't run pm2 save after we reset the services to use the new environment. Another student reported this problem and I updated the docs to reflect this. So unless you think there is something still outstanding I would like to close the pull request.

Jtrom314 commented 1 year ago

Sounds good!

On Fri, Mar 24, 2023, 6:37 AM Lee S Jensen @.***> wrote:

I'm guessing the problem was that we didn't run pm2 save after we reset the services to use the new environment. Another student reported this problem and I updated the docs to reflect this. So unless you think there is something still outstanding I would like to close the pull request.

— Reply to this email directly, view it on GitHub https://github.com/webprogramming260/.github/pull/35#issuecomment-1482733464, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXIHDZZ6GM6AHPGLGZSLIODW5WISPANCNFSM6AAAAAAV4GBTMQ . You are receiving this because you authored the thread.Message ID: @.***>

leesjensen commented 1 year ago

Resolved with other additions to the instruction. Specifically (455e89bd35e5d8919f39e2da897a89382add2478):

You then need to tell your Simon and Start Up services to use the new values found in the environment file. To do this you need to tell our service daemon, PM2, to reload its stored environment for all services that it manages. You then need to tell PM2 to save the new configuration so that it will persist when your server restarts. Run these commands from a SSH session on your production server.

pm2 restart all --update-env
pm2 save