mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-08 23:21:20 +01:00
New cloud9 instructions and steps from websockets update
This commit is contained in:
parent
f035308e17
commit
70aae0ab22
@ -15,10 +15,11 @@ For those who would like to run the codebase yourself, you may follow the instru
|
||||
7. Set the `Clone from Git or Mercurial url` to `git@github.com:TitanEmbeds/Titan.git` This should pull titan to your workspace.
|
||||
8. Right click `cloud9_install.sh` file at the left sidebar and click run. This will set everything up.
|
||||
9. Afterwards, just edit the respective config.py files in the webapp/discordbot directories and you are ready to go!
|
||||
10. Now you're ready to run Titan... webapp! To make the webapp to work, rightclick `run_c9.py` file and click run. Congratz! It will tell you the exact url where your stuff is running at.
|
||||
11. For discord bot, you can change the directory to the discordbot `cd discordbot/` and run `python3.5 run.py` to start the bot from the bash console!
|
||||
12. To make the login system work, go back to your discord bot applications page... for the redirect uris, add these: `http://xxx.cs50.io/user/callback` and `http://xxx.cs50.io/user/dashboard`. Replacing the `xxx` with your subdomain url in the webapp. That outta make the login work! (Take note that there is no http**s** in http).
|
||||
Now that you set everything up, take a step back and learn some ubuntu/bash to get familiar with it. Some things like git commit/push/pull, etc might be helpful. Maybe you can get phpmyadmin and inspect the database yourself, in gui form <https://community.c9.io/t/setting-up-phpmyadmin/1723>.
|
||||
10. Now you're ready to run Titan! To make the webapp to work, (1)Double click run_c9.py in the webapp folder, (2)At the menu bar: hit Run->Run With->Python3.5, to start the webapp.
|
||||
11. Do the same thing with run.py in the discordbot folder
|
||||
12. The console will show: wsgi starting up on `http://0.0.0.0:8080`. Click on that url and hit Open to view the local webapp.
|
||||
13. To make the login system work, go back to your discord bot applications page... for the redirect uris, add these: `http://xxx.cs50.io/user/callback` and `http://xxx.cs50.io/user/dashboard`. Replacing the `xxx` with your subdomain url in the webapp. That outta make the login work! (Take note that there is no http**s** in http).
|
||||
Now that you set everything up, take a step back and learn some ubuntu/bash to get familiar with it. Some things like git commit/push/pull, etc might be helpful.
|
||||
|
||||
## Pull Requesting
|
||||
If you do not have write access to the codebase, please make a fork of the project. Edit your changes on your fork and push it out onto GitHub. Afterwards, you may submit a pull request for your changes to be merged to the master branch (production). If you do however have write access to the repository, please create a branch and propose pull requests for me to merge into the production.
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "[C9Setup] Installing mysql, redis, and creating titan db table"
|
||||
echo "[C9Setup] Installing postgresql, redis, and creating titan db table"
|
||||
cd ~/workspace/
|
||||
mysql-ctl start
|
||||
mysql -u root -e "CREATE DATABASE titan;"
|
||||
sudo service postgresql start
|
||||
psql -c "CREATE DATABASE titan WITH ENCODING 'UTF8' TEMPLATE template0"
|
||||
sudo service redis-server start
|
||||
|
||||
echo "[C9Setup] Copying config.py for webapp/discordbot and alembic.ini"
|
||||
@ -12,34 +12,44 @@ cp ~/workspace/webapp/alembic.example.ini ~/workspace/webapp/alembic.ini
|
||||
|
||||
echo "[C9Setup] Installing Titan dependencies"
|
||||
cd ~/workspace/
|
||||
sudo python3.5 -m pip install -r requirements.txt
|
||||
sudo python3.5 -m pip install alembic pymysql eventlet uwsgi
|
||||
sudo python3.5 -m pip install --upgrade pip
|
||||
sudo python3.5 -m pip install -U -r requirements.txt
|
||||
sudo python3.5 -m pip install -U alembic psycopg2 eventlet
|
||||
|
||||
echo "[C9Setup] Auto populating alembic.ini database url and titan database table"
|
||||
cd ~/workspace/webapp
|
||||
#sqlalchemy.url = mysql+pymysql://root@localhost/titan
|
||||
sed -i '32s/.*/sqlalchemy.url = mysql+pymysql:\/\/root@localhost\/titan/' ~/workspace/webapp/alembic.ini
|
||||
#sqlalchemy.url = postgresql:///titan
|
||||
sed -i '32s/.*/sqlalchemy.url = postgresql:\/\/\/titan/' ~/workspace/webapp/alembic.ini
|
||||
alembic upgrade head
|
||||
|
||||
echo "[C9Setup] Setting database uri for discordbot/config.py"
|
||||
#'database-uri': "mysql+pymysql://root@localhost/titan",
|
||||
sed -i "4s/.*/\'database-uri\': \"mysql+pymysql:\/\/root@localhost\/titan\",/" ~/workspace/discordbot/config.py
|
||||
#'database-uri': "mysql+psycopg2:///titan?client_encoding=utf8",
|
||||
sed -i "4s/.*/\'database-uri\': \"postgresql+psycopg2:\/\/\/titan?client_encoding=utf8\",/" ~/workspace/discordbot/config.py
|
||||
|
||||
echo "[C9Setup] Setting database uri and app location for webapp/config.py"
|
||||
sed -i "11s/.*/\'database-uri\': \"mysql+pymysql:\/\/root@localhost\/titan\",/" ~/workspace/webapp/config.py
|
||||
sed -i "19s/.*/\'database-uri\': \"postgresql+psycopg2:\/\/\/titan?client_encoding=utf8\",/" ~/workspace/webapp/config.py
|
||||
#'app-location': "/home/ubuntu/workspace/webapp/",
|
||||
sed -i "8s/.*/\'app-location\': \"\/home\/ubuntu\/workspace\/webapp\/\",/" ~/workspace/webapp/config.py
|
||||
sed -i "16s/.*/\'app-location\': \"\/home\/ubuntu\/workspace\/webapp\/\",/" ~/workspace/webapp/config.py
|
||||
#'webosockets-mode': "eventlet",
|
||||
sed -i "21s/.*/\'websockets-mode\': \"eventlet\",/" ~/workspace/webapp/config.py
|
||||
|
||||
echo "[C9Setup] Making sure everything can be ran"
|
||||
cd ~/workspace/
|
||||
sudo chmod -R 777 *
|
||||
|
||||
echo "[C9Setup] Creating Cloud9 Python3.5 runner"
|
||||
mkdir .c9/runners
|
||||
touch .c9/runners/Python3.5.run
|
||||
echo '{ "cmd" : ["python3.5", "$file", "$args"], "info" : "Started $project_path$file_name on Python v3.5", "env" : {}, "selector" : "source.py" }' > .c9/runners/Python3.5.run
|
||||
|
||||
echo "[C9Setup] Resetting everything to the master branch"
|
||||
git reset --hard origin/master
|
||||
|
||||
echo "------------------------------"
|
||||
echo "Cloud9 Installation Done!!!!!"
|
||||
echo "If there are no errors, then you may proceed by editing the config.py files in the webapp and discordbot directories with your discord bottokens, etc."
|
||||
echo "Remember that your database uri is: mysql+pymysql://root@localhost/titan"
|
||||
echo "If there are no errors, then you may proceed by editing the config.py files in the webapp and discordbot directories with your discord bot tokens, etc."
|
||||
echo ""
|
||||
echo "After you finished editing those files, you may right click on run_c9.py and click run in the menu to start the webapp."
|
||||
echo "To run the discordbot, change your directory to discord bot: cd discordbot/"
|
||||
echo "and type the following command: python3.5 run.py"
|
||||
echo "After you finished editing those files, you may (1)Double click run_c9.py in the webapp folder, (2)At the menu bar: hit Run->Run With->Python3.5, to start the webapp"
|
||||
echo "Do the same thing with run.py in the discordbot folder"
|
||||
echo "The console will show: wsgi starting up on http://0.0.0.0:8080. Click on that url and hit Open to view the local webapp."
|
||||
echo "------------------------------"
|
||||
|
Loading…
Reference in New Issue
Block a user