Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Latest commit

 

History

History
235 lines (155 loc) · 6.06 KB

README.md

File metadata and controls

235 lines (155 loc) · 6.06 KB

README

SMILE aka Shared Housing Project

GitHub issues styles code style: prettier style lint

Table of Contents

Getting Started

To get a started working on this project you will need to do the following:

Prepare workstation for local development

Install the tools

  1. Python 3.7+
  2. NodeJS/NPM
  3. A unix-like shell environment supporting Bash (standard on Mac and Linux). For Windows users, this likely means installing a tool like Git Bash or Cygwin.

Get SSH keys

  1. Create your SSH key pair, if you do not have one. If prompted to overwrite existing SSH key, I recommend answering no as your existing key pair can likely be reused (assuming it was properly generated with a supported algorithm, e.g. RSA)
ssh-keygen
  1. Copy your SSH key to the server, you will be prompted for your password:
ssh-copy-id [email protected]

Get the code

  1. Fork this repo to your local repository
https://github.com/hackforla/shared-housing.git
  1. Pull your forked copy onto your local development environment
git clone <YOUR FORKED REPO URL>
  1. Navigate to the root of the project:
cd shared-housing

Install client dependencies

From the shared-housing directory:

  1. Enter the client directory:
cd client
  1. Install all declared dependencies:
npm install

Before continuing to install the server dependencies, return to the project root:

cd ..

Install server dependencies

From the shared-housing root, navigate to the server directory:

cd server

(Optional) Initialize your virtualenv or conda project. This guide assumes packages will be installed globally, as this is the way the Docker image is configured to build. If you are using a virtual environment, remember to adjust any pip commands as needed, and activate/deactive your environment(s). This will be the only mention of the conda or venv commands in this guide.

# create conda environment
conda create -n sharedhousing python
conda activate

# OR: create virtualenv environment
venv sharedhousing_env
source sharedhousing_env/bin/activate

Install the Python packages

pip install -r requirements.txt

# OR
conda install --file requirements.txt

Before continuing to build the client application, return to the project root:

cd ..

Deploy the app on the server

Build the React application

Ensure the build script is executable

chmod +x build-deb.sh

From the project root, run the following command to execute the build script:

./build-deb.sh

Copy the files to the server.

scp -r server [email protected]:/home/sharedhousing/app

If you made changes to the server-side code, you also need to log in and reboot

# Log in to server
ssh [email protected]

# Reboot app service. You will be prompted for your password
sudo systemctl restart app

# Restart nginx, if necessary
sudo systemctl restart nginx

If you encounter runtime issues that appear to be server-related, check the app logs and nginx logs.

# View app logs, will contain errors that occurred at the application level
sudo journalctl -u app

# View nginx logs, will contain errors that occurred at the HTTP level
sudo journalctl -u nginx

Deploy the app locally

Build the React application

Ensure the build script is executable

chmod +x build-deb.sh

From the project root, run the following command to execute the build script:

./build-deb.sh

Navigate to the server directory

cd server

Launch the Flask application. Leave your terminal open after running this command, your server logs will print here as you interact with the React application from the browser

python app.py

To get the React client running locally:

cd client/
npm run dev

The project also support storybook to allow for viewing components in isolation from the project

npm run storybook

Technologies

References

License

Licensed Under: GNU General Public License v3.0