-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
# CLONES FOR EVERYBODY | ||
|
||
## Setup | ||
|
||
This has been tested with Ubuntu 14.04 on a Digital Ocean server. | ||
|
||
Run: | ||
```bash | ||
$ ./setup/setup.sh | ||
``` | ||
|
||
If you're having issues: | ||
* nginx logs: `/var/log/nginx/` | ||
* supervisor logs: `/var/log/supervisor/` | ||
* celery logs: `/var/log/celery/` | ||
* application logs: `/var/log/ustwo.log` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
server { | ||
listen 80; | ||
server_name ustwo.hyper.pub; | ||
|
||
location /static { | ||
alias /srv/ustwo/app/static; | ||
} | ||
|
||
location / { | ||
include uwsgi_params; | ||
uwsgi_pass unix:/tmp/uwsgi.sock; | ||
uwsgi_param UWSGI_PYHOME /env/ustwo; | ||
uwsgi_param UWSGI_CHDIR /srv/ustwo; | ||
uwsgi_param UWSGI_MODULE application; | ||
uwsgi_param UWSGI_CALLABLE app; | ||
} | ||
|
||
error_page 404 /404.html; | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Get ready | ||
sudo apt-get update && sudo apt-get upgrade | ||
|
||
# Packages | ||
sudo apt-get install nginx python3-pip git uwsgi supervisor uwsgi-plugin-python uwsgi-plugin-python3 ruby npm rabbitmq-server | ||
|
||
# NPM/Bower | ||
sudo ln -s /usr/bin/nodejs /usr/bin/node | ||
sudo npm install -g bower | ||
|
||
# MongoDB | ||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | ||
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | sudo tee -a /etc/apt/sources.list | ||
sudo apt-get update && sudo apt-get upgrade | ||
sudo apt-get install mongodb-10gen | ||
sudo service mongodb start | ||
|
||
# Virtualenv | ||
pip3 install virtualenv | ||
virtualenv -p python3 /env/ustwo --no-site-packages | ||
|
||
# Sass | ||
gem install sass | ||
|
||
# Setup app | ||
cd /srv | ||
git clone https://github.com/publicscience/ustwo.git | ||
cd /srv/ustwo | ||
source /env/ustwo/bin/activate | ||
pip install -r requirements.txt | ||
bower install | ||
|
||
# Celery | ||
sudo mkdir /var/log/celery | ||
sudo adduser --system celery --group | ||
|
||
# Supervisor | ||
sudo cp /srv/ustwo/setup/supervisor/*.conf /etc/supervisor/conf.d/ | ||
|
||
# Nginx | ||
sudo sed -i '' 's/# server_names_hash_bucket_size/server_names_hash_bucket_size/g' /etc/nginx/nginx.conf | ||
sudo cp /srv/ustwo/setup/nginx/*.conf /etc/nginx/conf.d/ | ||
|
||
# Restart | ||
sudo service nginx restart | ||
sudo service supervisor restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[program:celery] | ||
; Set full path to celery program if using virtualenv | ||
command=/env/ustwo/bin/celery worker --loglevel=INFO --config=config | ||
|
||
directory=/srv/ustwo | ||
stdout_logfile=/var/log/celery/worker.log | ||
stderr_logfile=/var/log/celery/worker.log | ||
autostart=true | ||
autorestart=true | ||
startsecs=10 | ||
|
||
user=celery | ||
group=celery | ||
|
||
; Need to wait for currently executing tasks to finish at shutdown. | ||
; Increase this if you have very long running tasks. | ||
stopwaitsecs = 600 | ||
|
||
; When resorting to send SIGKILL to the program to terminate it | ||
; send SIGKILL to its whole process group instead, | ||
; taking care of its children as well. | ||
killasgroup=true | ||
|
||
; if rabbitmq is supervised, set its priority higher | ||
; so it starts first | ||
priority=998 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[program:ustwo] | ||
command=/usr/bin/uwsgi --plugin python3 -s /tmp/uwsgi.sock -w application:app -H /env/ustwo --chmod-socket=666 | ||
directory=/srv/ustwo | ||
autostart=true | ||
autorestart=true | ||
stdout_logfile=/var/log/ustwo.log | ||
redirect_stderr=true | ||
stopsignal=QUIT |