-
Notifications
You must be signed in to change notification settings - Fork 2
Developer's Guide
Looking to get started developing and improving WiCHacker-Manager? This is where you should start
The most important priority of the WiCHacker-Manager is to try and future-proof the application. Whenever possible we have chosen the simplest or easiest to understand/operate alternative to solve an issue. Since our application load is relatively small and the turnover of maintainers will be very large, we do not need optimizations that will make things harder to understand for future developers who may not be as familiar with the technology.
- Sometimes UI development differs from production behavior because we are using react dev server vs productionized build
AWS Required Services:
- EC2 - compute
- S3 - resume storage
- ParameterStore - secret storage
- IAM - permissions
- RDS - database
- Cloudwatch - viewing logs
DNS Updates:
- Cloudflare
Quick Note: Local development still relies on AWS secrets and everything is determined by environment variables to configure local vs production configurations
Notes on Running the Application:
The database is run in a local docker container. You can also run a database outside of a container, but the connection information comes from secrets so make sure your database matches that same configuration
Most local development is dependent on running the applications on your computer. If you are developing the UI, you can run the API in a docker container. If you are developing the API, I would recommend running both locally to speed up development and you won’t have to worry about as many docker networking issues like calling containers by name as opposed to using localhost.
- Setup AWS Account
- Have AWS Root User Create User Account
- Generate AWS Secret Pair through IAM
- Root User will have to authorize permissions for new user
- Create .aws folder in user’s home directory
- Credentials tell the application who you are, while config tells it to look in the correct region for our tools
- Create ~/.aws/credentials file
- See below for default credentials file
- Create ~/.aws/config file
- See below for default config file
- Clone Repository
- Make sure your github account is in the WiCHacks github organization
- Lana, Webmaster, WiCHacks Director, Projects Director or Logistics Director should be able to make this happen
- Clone the WiCHacker-Manager repository
- Make sure your github account is in the WiCHacks github organization
- Install docker and docker-compose
- NOTE: This is the only place in this guide where there will be a difference between operating systems. All other commands have only been verified to work on a Mac dev environment
- Mac
- Navigate to the docker download page and click the download for your applicable Mac. Make sure to choose Intel or Apple Silicon accordingly
- Open the .DMG file that was downloaded. Then, like any other Mac app, drag it to the applications folder
- Close the DMG, and then open the newly installed Docker app
- When you launch it for the first time, Docker will ask you for your administrator password. This is normal, and safe. Docker is a trusted tool.
- Docker will load, potentially open another authorization prompt, let it load
- Eventually, Docker will settle down, and you should see a window with a green bar in the bottom left corner
- NOTE: You will need Docker running while developing on this project
- Windows
- Use WSL
- Install Dependencies
- Fronted
- Install NPM
- Navigate to the
/uidirectory and runnpm install
- Backend
- Navigate to the
/apidirectory - Run
pip install -r requirements.txt
- Navigate to the
- Database (Optional)
- Pull Mysql docker image
- Run
docker pull mysql:8.0.28
- Fronted
- Run Applications
- NOTE: This portion of the guide assumes you are running the front and backend directly on your computer and the database in a Docker container
- Frontend
- Navigate to
/uifolder - Open
package.json- On line 5, add
"proxy": "https://localhost:5002",
- On line 5, add
- Open
/src/config/axios.js- Change apiDomain to
return localApiDomain - Change getAxios to
return localAxios
- Change apiDomain to
- Run
npm start - Application should start running on
http://localhost:3000
- Navigate to
- Database
- NOTE TO ALEX TO ACTUALLY DO THIS ASAP
- Backend
- Navigate to
/api - Open
/src/server.py - All the way at the bottom, change
app.run()to include the additional parameterport=5002 - Run
server.py - NOTE: If the database is not running, or AWS connections are not enabled, this will error
- Navigate to
./aws/credentials
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
./aws/config
[default]
region=us-east-1
output=json
Pre-Requisites: Make sure you have the infrastructure up and running before continuing.
- SSH into EC2
- Clone repository
- Create SSH keypair
- Add keypair to GitHub account
- Run
clone
- Navigate to root of project directory
- Run
docker-compose -f prod-docker-compose.yml up -d - Navigate to https://apply.wichacks.io and verify
The frontend of WiCHacker Manager is built in React. React was chosen as it is one of the largest frameworks available as of the start of development, as well as being taught by the Software Engineering department at RIT.
There are currently two higher order components that assist with authentication and authorization of pages. They can be found in the hocs folder, while being utilized in the routes.js file protecting different routes with differing levels of security.
Javascript can be hard for backend developers. The triple equals, the non-obvious truthy statements and null checks can look somewhat foreign to those who aren’t super familiar with front end development. I know there are many super cool and very succinct javascript patterns that can be quite efficient and useful, but I would recommend avoiding these when possible as the functionality can be obscure. If it is necessary to use a super concise pattern, please make sure to heavily comment this code to increase readability for future developers.
Our users will likely be very technical. As such, try not to include any console logs to keep as much information as possible hidden from the users. WiCHacks is a big target for malicious actions of all sorts so security and protecting errors / vulnerabilities is very important for us.
Our infrastructure for both production and local development relies on AWS.
If someone wants to switch cloud providers in the future, please investigate very thoroughly to make sure every way AWS is currently utilized is understood. There are a few hidden benefits that most likely exist at all cloud providers but require understanding and additional setup beyond just getting some allocated space on a cloud provider’s machines.
WiCHacks 💜 Women in Computing 💜 Rochester Institute of Technology