diff --git a/README.md b/README.md index 59f2df878..ef98d3372 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,37 @@ [![Join Kerala Rescue Slack channel](https://i.imgur.com/V7jxjak.png)](http://bit.ly/rescuechat) + +## Easy Setup for quick contributions for Apple Mac and Ubuntu Linux +``` +git clone https://github.com/IEEEKeralaSection/rescuekerala.git +cd rescuekerala +sh easy-setup.sh +``` + ## Table of Contents -- [Requirements](#requirements) - - [Docker](#docker) - - [Python 3](#python-3) - - [Postgres](#postgres) - - [Git](#git) - - [Redis](#redis) - - [Setting up an S3 Account](#setting-up-an-s3-account) -- [Getting started](#getting-started) - - [Setting up a development environment](#setting-up-a-development-environment) - - [Setup using docker-compose](#setup-using-docker-compose) -- [Creating migration files](#creating-migration-files) -- [Running tests](#running-tests) -- [Enable HTTPS connections](#enable-https-connections) +- [Easy Setup for quick contributions for Apple Mac and Ubuntu Linux](#easy-setup-for-quick-contributions-for-apple-mac-and-ubuntu-linux) +- [Table of Contents](#table-of-contents) + - [Requirements](#requirements) + - [Docker](#docker) + - [Python 3](#python-3) + - [Postgres](#postgres) + - [Git](#git) + - [Redis](#redis) + - [Setting up an S3 Account](#setting-up-an-s3-account) + - [Getting Started](#getting-started) + - [Setting up a development environment](#setting-up-a-development-environment) + - [Setup using docker-compose](#setup-using-docker-compose) + - [Pre-requisites](#pre-requisites) + - [Creating migration files](#creating-migration-files) + - [Running tests](#running-tests) + - [Enable HTTPS connections](#enable-https-connections) + - [Note: Make sure that this change is removed before pushing your changes back to git](#note-make-sure-that-this-change-is-removed-before-pushing-your-changes-back-to-git) - [How can you help?](#how-can-you-help) - [Verification of Rescue Requests](#verification-of-rescue-requests) - [Contribution Guidelines](#contribution-guidelines) - [Testing PRs](#by-testing) - [Submitting PRs](#submitting-pull-requests) -
### Requirements diff --git a/easy-setup.sh b/easy-setup.sh new file mode 100644 index 000000000..5d9a12416 --- /dev/null +++ b/easy-setup.sh @@ -0,0 +1,80 @@ +OS_BASE=$`(uname)` +BUILD_MAC=$"Darwin" +BUILD_LIN=$"Linux" +BUILD_WIN="Windows" +KERALARESCUE_REPO_LINK="https://github.com/IEEEKeralaSection/rescuekerala.git" +# Commands for Apple Mac +if [ $OS_BASE == $BUILD_MAC ] +then +# Install Git and the repo for Kerala Rescue +brew install git +# ======= Uncomment the following line if you do not have the repository downloaded +# git clone $KERALARESCUE_REPO_LINK +echo "Repository is downloaded now you are ready to go" +cd rescuekerala/ +# Install python and pip in mac +brew install python +# Install requirements.txt +pip3 install -r requirements.txt +pip3 install -r requirements_debug.txt +# Implementing docker.sh +chmod 777 docker.sh +sh docker.sh +# PostgreSQL : Expecting that brew is preinstalled in your mac +brew install postgres +ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents +alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist" +alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist" +pg_start +# Use pg_stop to stop the postgres server. +createdb `whoami` +brew reinstall readline +createuser -s postgres +createdb rescuekerala +psql -f postgres_setup.sql rescuekerala +# Copy the environment config to the remote repo +# -- Additional configuration maybe required +cp .env.example .env +# Database migration for Django and run the server +python3 manage.py migrate +python3 manage.py collectstatic +python3 manage.py runserver +else +# Commands for Linux[Ubuntu] +if [ $OS_BASE == $BUILD_LIN ] +then +# linux commands (for ubuntu) +# Install Git and the repo +sudo apt-get install git +# git clone $KERALARESCUE_REPO_LINK +echo "Repository is downloaded now you are ready to go" +cd rescuekerala/ +# Install Python and pip +sudo apt-get intall python3 +sudo apt-get install python3-pip +# Install requirements.txt +pip3 install -r requirements.txt +pip3 install -r requirements_debug.txt +# Implementing docker.sh +chmod 777 docker.sh +sh docker.sh +# Postgres setup and installation +# sudo apt-get install wget ca-certificates +# wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - +# sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' +sudo apt-get update +sudo apt install postgresql-common +sudo sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh +sudo -i -u postgres +createuser -s postgres +createdb rescuekerala +psql -f postgres_setup.sql rescuekerala +# Copy the environment config to the remote repo +# -- Additional configuration maybe required +cp .env.example .env +# Database migration for Django and run the server +python3 manage.py migrate +python3 manage.py collectstatic +python3 manage.py runserver +fi +fi \ No newline at end of file diff --git a/postgres-setup.sql b/postgres-setup.sql new file mode 100644 index 000000000..f82383dfc --- /dev/null +++ b/postgres-setup.sql @@ -0,0 +1,3 @@ +CREATE USER rescueuser WITH PASSWORD 'password'; +GRANT ALL PRIVILEGES ON DATABASE rescuekerala TO rescueuser; +\q