This post has been de-listed (Author was flagged for spam)
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
So I have a website that uses React on the frontend and Python on the backend. This has been a great learning experience in every aspect, and the latest skills I've had to learn about is deployment and CI/CD. Here is my architecture, feel free to comment any thoughts/friendly advice/praise you have about the system!
System Design:
- I'm using Nginx as a reverse proxy on a remote Ubuntu server. I have it configured to reroute all HTTP traffic to HTTPS.
- I also have 2 environments configured, dev and prod, that exist as directories inside
/var/www
.- Within the Nginx config, I have all frontend requests routed to a build folder and all requests to
/api/*
routed to an api folder, within the correct environment.
- Within the Nginx config, I have all frontend requests routed to a build folder and all requests to
- I'm using pm2 to serve 2 processes - a production API service and a development API service
- I've created 2 workflows within GitHub actions, that work as follows:
- On push to the dev/prod branches (branch protected, so it's functionally on completed merge request) the workflow will run.
- It will SSH into the machine using secrets I've stored in the repo settings
- For the frontend
- it will cd to the dir
- switch to the correct branch and pull
- install any dependencies
- run react build
- and copy the build into the correct directory, so that Nginx can serve it
- For the backend
- it will cd to the dir
- switch to the correct branch and pull
- copy the entire backend directory
./api-service/...
to the correct directory - activate the virtual env
- install any dependencies
- restart the pm2 service
And that's pretty much it! I don't have any users, so there isn't a big concern with scale. This is just to help me think about a situation if I did have users, and how I would develop without disrupting their experience
Post Details
- Posted
- 10 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/devops/comm...