Deployment Guide - samayasankuratri/flask_portfolio GitHub Wiki
Deployment process
- Deployment is going to be run by Canakit's raspberry pi 4.
- VNC will need to be downloaded to be able to access the raspberry pi.
- First, in terminal, set up the requirements and packages needed to run the raspberry pi.
- Next, add git to the terminal (git clone) and make sure the clone and cd name match the repository name. (Found on Nighthawk Coders github)
- Then, activate the environment by installing Gunicorn and requirements.txt
- Test Gunicorn and python in the browser.
- Build and Validate Gunicorn and Nginx configuration files.
- Register the public IP address to a Domain.
Frequency
- Scrum Master or TO will take over if Deployment manager is absent.
- All git commits will need to be added to the deployed website through terminal (git pull).
- Commits should be pushed 2 days before the deadline to ensure that there are no problems.
- Website should be updated twice a week.
How to Update Deployed Website
- Log into VNC viewer and open terminal on the raspberry pi
- check the present working directory (pwd)
- If already in flask_portfolio do not do the next step
- If it says pi/home type "cd flask_portfolio" to change the directory
- Then type git stash to stash any local changed
- Now type git pull
- Once all the code is pulled restart the service file with these commands
- sudo systemctl start studyowl.service
- sudo systemctl enable studyowl.service
- sudo systemctl status studyowl.service
- Next type source studyowl/bin/activate to activate the virtual environment
- Then type python main.py to start the website again with updated code
About Branches
- Use a branch to isolate development work without affecting other branches in the repository. Each repository has one default branch, and can have multiple other branches. You can merge a branch into another branch using a pull request.
- You always create a branch from an existing branch. Typically, you might create a new branch from the default branch of your repository. You can then work on this new branch in isolation from changes that other people are making to the repository. A branch you create to build a feature is commonly referred to as a feature branch or topic branch.
- Creating a branch:
- On GitHub.com, navigate to the main page of the repository.
- Optionally, if you want to create your new branch from a branch other than the default branch for the repository, click NUMBER branches then choose another branch:
- Click the branch selector menu.
- Type a unique name for your new branch, then select Create branch.
- Once you're satisfied with your work, you can open a pull request to merge the changes in the current branch (the head branch) into another branch (the base branch). For more information, creating/merging pull requests.
Creating a pull request:
- Create a pull request to propose and collaborate on changes to a repository. These changes are proposed in a branch, which ensures that the default branch only contains finished and approved work.
- When thinking about branches, remember that the base branch is where changes should be applied, the head branch contains what you would like to be applied.
- When you change the base repository, you also change notifications for the pull request. Everyone that can push to the base repository will receive an email notification and see the new pull request in their dashboard the next time they sign in.
- Follow these steps to create a pull request:
- After you did your test commit, go to GitHub.com, click pull requests, and click New Pull Request Change the compare branch to your own branch(find your name)
- On the top left side, change the base repository to our repository (samayaas/flask_portfolio)
- Then you can see the test commit that you did, click create pull request
- You can name the pull request whatever you like, you can name it by your name or the thing/feature that you are working on or etc. Then click create pull request.
- You're done with creating your own pull request!! All the commits you push afterwards will go here, and once you are done with your thing or the feature that you are working on, you can merge the pull request, which then everyone can see the changes that you’ve made.
- Merge a pull request into the upstream branch when work is completed. Anyone with push access to the repository can complete the merge.
- In a pull request, you propose that changes you've made on a head branch should be merged into a base branch. By default, any pull request can be merged at any time, unless the head branch is in conflict with the base branch.
- Under your repository name, click Pull requests.
- In the "Pull Requests" list, click the pull request you'd like to merge.
- Merge all of the commits into the base branch by clicking Merge pull request. If the Merge pull request option is not shown, then click the merge drop down menu and select Create a merge commit.
- Click Confirm merge.
- Optionally, you can delete the branch after you merge. This keeps the list of branches in your repository tidy. And you can create new pull requests once you start working on another feature or etc.