Replies: 13 comments 43 replies
-
1) Where are the following commands run?I assume this is a user added to DigitalOcean:
Source: https://github.com/codebuddies/backend/wiki/Production-Deployment |
Beta Was this translation helpful? Give feedback.
-
2) Any tips for how to start debugging?PR so far: https://github.com/codebuddies/backend/pull/176/files If I go to api-staging.codebuddies.org right now, I see: I am guessing there may be some secrets (as documented in https://github.com/codebuddies/backend/wiki/Production-Deployment) that I need to update. So far the only secret I've updated is |
Beta Was this translation helpful? Give feedback.
-
FYI - I've suggested a slot for pairing on things identified in this thread. |
Beta Was this translation helpful? Give feedback.
-
Learnings from pairing on GitHub Actions and Docker deployment w/ @billgloverSeptember 20th, 2020 stream (2 hours)Recording: https://www.youtube.com/watch?v=ZfEUFMCUveQ&feature=youtu.be The branch: How do I create a new ssh key to link up the DO droplet and GitHub Actions?
DNS?(Punting on DNS for now) Reverse proxy notesBest practice is to stick a reverse proxy (e.g. nginx, traefik) in front of Django when you deploy it. In development, you don't have a reverse proxy. The production setup uses the reverse proxy to serve the staticfiles as well as the proxy request that comes into django. ... two separate stacks... common network which is externalHere, the error message is that we haven't created the network stack Do we need reverse proxy? How to do it? One answer: put it inside docker-compose stackSSL, TLS, http piece makes it difficult to do different stacks per release version nginx DO_AUTH_KEYWe deleted this during the stream. The DJANGO_ALLOWED_HOSTSNote: if there's a bug associated with it moving foward, set it to Trigger the action on a tag which will give the version numberNote: can look into later. We have Would tag packages with the version number.That tag gets passed through an environment variablethrough docker-compose which pulls the latest versionof the container image. Why that matters: what happens if you redeploy the sameimage and the tag hasn't changed Stop the currently running one and re-pull the imagebut lose track of it without the tagging DO_STAGING_SSH_PORTNo port exposed from that container, so not publicly accessible TODO: a couple of warnings if we run
|
Beta Was this translation helpful? Give feedback.
-
Deployment workflow proposal discussionStrawman proposal #1:
Strawman proposal #2:
|
Beta Was this translation helpful? Give feedback.
-
❓ Separate question -- can we get away with the api-staging.codebuddies.org Postgres DB_not_ being a managed DB in DigitalOcean ($15/mo)? Or would it be better if both staging and prod were each managed DBs in DigitalOcean? (For example, for github.com/codebuddies/codebuddies, staging spoke to a free-plan DB on mlab while production spoke to a MongoDB Atlas DB that was not free) |
Beta Was this translation helpful? Give feedback.
-
New error! I think this is because I need to updated the
|
Beta Was this translation helpful? Give feedback.
-
I was going to chime in and say those missing environment variables might be problematic, but it looks as though things are now working. |
Beta Was this translation helpful? Give feedback.
-
Some deployment notes:
Still to do:
|
Beta Was this translation helpful? Give feedback.
-
Thanks Bill! I think you'll have to make it unlisted for me to see it
(don't think it's possible to share private videos with other emails).
(Or you can email me an unlisted link)
…On Thu, Nov 19, 2020, 5:26 AM Bill Glover ***@***.***> wrote:
Recording uploaded here <https://youtu.be/ZgsRd3_0gSY> (currently a
private link).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#177 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCNXO7GAQYIY7FM4I2JRNLSQUMJZANCNFSM4Q43RRNA>
.
|
Beta Was this translation helpful? Give feedback.
-
LOL I didn't realize you'd uploaded to the CodeBuddies YT account 😂
<https://emojipedia.org/face-with-tears-of-joy/>
I <https://emojipedia.org/face-with-tears-of-joy/> couldn't see it earlier
because I was logged in to a different account (and thought it was under a
personal account), but got it now. I'll make it private again unless
someone else requests access, and watch/take notes later. Thanks again!
…On Fri, Nov 20, 2020 at 6:42 AM Bill Glover ***@***.***> wrote:
Done, changed the link to be unlisted. It's available
<https://youtu.be/ZgsRd3_0gSY> in the CodeBuddies channels.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#177 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCNXO77H234UNF7UKXG44DSQZ54ZANCNFSM4Q43RRNA>
.
|
Beta Was this translation helpful? Give feedback.
-
Notes from Bill's nginx deployment recording (work in progress)GH Actions workflow builds a container image The article at https://www.digitalocean.com/community/tutorials/how-to-scale-and-secure-a-django-application-with-docker-nginx-and-let-s-encrypt#step-3-%E2%80%94-configuring-the-nginx-docker-container talks about building a container image on the droplet itself, and has multiple servers. We've already built our container image using GH Actions (and hosted on GH). Goal: get nginx deployedKnown issue: environment variables not set in the session Potentially, we can put these environment variables into a file. (Note from Linda: I actually saved values for those secret keys into GitHub secrets, but docker didn't seem to register the change) Trying: docker port [CONTAINER_ID] Expose the port on a running containerWe've found our application! Explanation: docker container is running, but what is serving the django app? The Django app is deployed in the production configuration which sets up the redirect from http to https. We want to see if a request made to port 8000 was actually being responded to. When we were running this outside the container, the port wasn't exposed. Rather than fix exposing the port outside the container, we created a terminal session inside the container and used CURL to validate that the expected behavior is happening -- i.e. when we do So now we know the app server is serving correctly! Now, back into getting nginx deployed correctly. (13:26) We make a new directory conf and (18:31) (TO BE CONTINUED) |
Beta Was this translation helpful? Give feedback.
-
Auto-renewing certificates🤔 What's the difference between the |
Beta Was this translation helpful? Give feedback.
-
Logging some deployment questions for @billglover here! My guess is that it would be most efficient to walk through this in a hangout/Twitch stream soon, but here are some documented questions in advance.
#Context
Goal: deploy an api-staging.codebuddies.org URL partly to document the process, and partly so that folks who don't have the wifi bandwidth to install Docker (or can't install Docker for Windows properly because their computer does not have memory) can have a staging URL to make requests against from frontend app.
Resources I followed:
What I did:
Note: I found the fingerprint via this link: https://cloud.digitalocean.com/account/security?i=0c2df0
Staging
at https://github.com/codebuddies/backend/actions?query=workflow%3AStaging. It's tied to a new branch calledstaging-deployment-experiment
.Workflow file: https://github.com/codebuddies/backend/actions/runs/241969451/workflow
I changed the work directory to be
workdir: project
instead ofworkdir: cbv3_django_prototype
, since we changed out those names.I went to https://github.com/codebuddies/backend/settings/secrets and updated the value for
DO_STAGING_DB_URL
to be the new database URL I saw that was given ashost
in the PostGres instance -- e.g. something likedb-postgresql-sfo2-XXXXX-do-user-XXXXXXX-0.db.ondigitalocean.com
In DigitalOcean under the
Networking
tab, I updated the DNS recording for api-staging.codebuddies.org to point to the IP address of the new droplet I created in a previous step instead of the IP it was pointing to before, which looked like a Ghost blog.Created a docker-compose-staging.yaml file here: https://github.com/codebuddies/backend/blob/046a1c4486ce15e5041f23bde104d6b5fece4d47/project/docker-compose-staging.yaml, based off of the early PR diff.
Updated the
production.py
file to follow the original diff:backend/project/config/settings/production.py
Line 101 in 0aae81b
This isn't working yet, so questions as new threads below!
Beta Was this translation helpful? Give feedback.
All reactions