cd ~/environment && git clone https://github.com/Sresht/lect11-starter/ && cd lect11-starter
- Install your stuff!
a)npm install
b)pip install flask-socketio
c)pip install eventlet
d)npm install -g webpack
e)npm install --save-dev webpack
f)npm install socket.io-client --save
⚠️ ⚠️ ⚠️ If you see any error messages, make sure you usesudo pip
orsudo npm
. If it says "pip cannot be found", runwhich pip
and usesudo [path to pip from which pip] install
⚠️ ⚠️ ⚠️ - If you already have psql set up, SKIP THE REST OF THE STEPS AND JUST DO THE FOLLOWING COMMAND:
sudo service postgresql start
- Copy your
sql.env
file into your new directory.
- Update yum:
sudo yum update
, and enter yes to all prompts - Upgrade pip:
sudo /usr/local/bin/pip install --upgrade pip
- Get psycopg2:
sudo /usr/local/bin/pip install psycopg2-binary
- Get SQLAlchemy:
sudo /usr/local/bin/pip install Flask-SQLAlchemy==2.1
- Install PostGreSQL:
sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
Enter yes to all prompts. - Initialize PSQL database:
sudo service postgresql initdb
- Start PSQL:
sudo service postgresql start
- Make a new superuser:
sudo -u postgres createuser --superuser $USER
⚠️ ⚠️ ⚠️ If you get an error saying "could not change directory", that's okay! It worked!⚠️ ⚠️ ⚠️ - Make a new database:
sudo -u postgres createdb $USER
⚠️ ⚠️ ⚠️ If you get an error saying "could not change directory", that's okay! It worked!⚠️ ⚠️ ⚠️ - Make sure your user shows up:
a)psql
b)\du
look for ec2-user as a user
c)\l
look for ec2-user as a database - Make a new user:
a)psql
(if you already quit out of psql) b) I recommend 4-5 characters - it doesn't have to be very secure. Remember this password!
create user [some_username_here] superuser password '[some_unique_new_password_here]';
c)\q
to quit out of sql cd
intolect11
and make a new file calledsql.env
and addSQL_USER=
andSQL_PASSWORD=
in it- Fill in those values with the values you put in 7. b)
There's a special file that you need to enable your db admin password to work for:
- Open the file in vim:
sudo vim /var/lib/pgsql9/data/pg_hba.conf
If that doesn't work:sudo vim $(psql -c "show hba_file;" | grep pg_hba.conf)
- Replace all values of
ident
withmd5
in Vim::%s/ident/md5/g
- After changing those lines, run
sudo service postgresql restart
- Ensure that
sql.env
has the username/password of the superuser you created! - Run your code!
a)npm run watch
. If prompted to install webpack-cli, type "yes"
b) In a new terminal,python app.py
c) Preview Running Application (might have to clear your cache by doing a hard refresh)