-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π Add heroku deployment configuration files
- Loading branch information
1 parent
8800791
commit 462b27a
Showing
11 changed files
with
100 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
heroku buildpacks:clear | ||
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-nginx.git | ||
heroku buildpacks:add --index 2 heroku/python | ||
heroku buildpacks:add --index 3 https://github.com/heroku/heroku-buildpack-nodejs#v170 | ||
# Just print buildpacks configuration | ||
heroku buildpacks |
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 @@ | ||
web: honcho start -f santosbot.Procfile |
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 @@ | ||
#!/usr/bin/env bash | ||
# Install poetry with specific version | ||
pip install "poetry==1.0.5" | ||
# Project initialization without creating virtalenv | ||
poetry config virtualenvs.create false | ||
poetry install $([ "$ENVIRONMENT" = 'production' ] && echo "--no-dev") --no-interaction --no-ansi | ||
# Run project | ||
uvicorn api:app --port 8888 --host 0.0.0.0 |
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,4 @@ | ||
#!/usr/bin/env bash | ||
# Install bot requirements | ||
pip install --no-cache-dir -r requirements.txt | ||
python main.py |
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,56 @@ | ||
daemon off; | ||
# Heroku dynos have at least 4 cores. | ||
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>; | ||
|
||
events { | ||
use epoll; | ||
accept_mutex on; | ||
worker_connections <%= ENV['NGINX_WORKER_CONNECTIONS'] || 1024 %>; | ||
} | ||
|
||
http { | ||
gzip on; | ||
gzip_comp_level 2; | ||
gzip_min_length 512; | ||
|
||
server_tokens off; | ||
|
||
log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id'; | ||
access_log <%= ENV['NGINX_ACCESS_LOG_PATH'] || 'logs/nginx/access.log' %> l2met; | ||
error_log <%= ENV['NGINX_ERROR_LOG_PATH'] || 'logs/nginx/error.log' %>; | ||
|
||
include mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
|
||
# Must read the body in 5 seconds. | ||
client_body_timeout <%= ENV['NGINX_CLIENT_BODY_TIMEOUT'] || 5 %>; | ||
|
||
server { | ||
listen <%= ENV["PORT"] %>; | ||
server_name _; | ||
keepalive_timeout 5; | ||
client_max_body_size <%= ENV['NGINX_CLIENT_MAX_BODY_SIZE'] || 1 %>M; | ||
|
||
location / { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
proxy_redirect off; | ||
# Proxy pass ExpressJS Server. | ||
proxy_pass http://127.0.0.1:8080; | ||
} | ||
|
||
# Proxy pass to Backend service | ||
location /api/ { | ||
proxy_pass http://127.0.0.1:8888/; | ||
proxy_http_version 1.1; | ||
proxy_redirect default; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Host $server_name; | ||
} | ||
} | ||
} |
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,4 @@ | ||
#!/usr/bin/env bash | ||
echo "Installing npm packages..." | ||
npm install | ||
echo "Done!" |
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
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,4 @@ | ||
{ | ||
"name": "ahah, fooled you heroku π", | ||
"version": "0.1.0" | ||
} |
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,2 @@ | ||
# ahah, fooled you heroku π | ||
honcho |
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 @@ | ||
python-3.7.2 |
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,3 @@ | ||
frontend: cd frontend && ./heroku.sh && cd .. && bin/start-nginx node frontend/server.js | ||
backend: cd backend && ./heroku.sh | ||
bot: cd bot && ./heroku.sh |