Skip to content

Commit 413ac50

Browse files
committed
add replit support (closes #72)
1 parent c383e46 commit 413ac50

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed
File renamed without changes.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
> Fastest proxy using only nginx as the backend server
44
5-
**Before you deploy to Heroku, read the following: apparently, heroku decided that this repository violates the ToS, so directly clicking the button below if you're in the main repository will result in an error. You can avoid this by forking a repo, then clicking on this deploy button on your own cloned repo. However, I am NOT responsible if your heroku account gets suspended because of deploying this application. Proceed at your own risk.**
5+
<a href="https://repl.it/github/binary-person/womginx"><img src="https://docs.replit.com/images/repls/run-on-replit.svg" alt="Replit" width="150"/></a>
6+
7+
**Before you deploy to Heroku, read the following: Heroku decided that this repository violates the ToS, so directly clicking the button below if you're in the main repository will result in an error. Forked repositories may work, though this is not guaranteed. Regardless, I am NOT responsible if your Heroku account gets suspended because of deploying this application. Proceed at your own risk.**
68

79
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
810

replit-run.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
11
#!/bin/bash
22

3+
set -e
4+
5+
DIR=$(pwd)
6+
ESCAPED_DIR=$(echo $DIR | sed -e 's/\//\\\//g')
7+
38
git pull
9+
10+
# install and build wombat or just update if the folder already exists
11+
if [ ! -d $DIR/public/wombat/dist ]; then
12+
git submodule update --init --recursive
13+
cd $DIR/public/wombat
14+
npm install && npm run build-prod
15+
fi
16+
17+
cd $DIR
18+
19+
# modify replit-nginx.conf without modifying nginx.conf to avoid git pull conflict message
20+
rm -rf replit-nginx-temp
21+
mkdir replit-nginx-temp
22+
cp nginx.conf replit-nginx-temp/
23+
cd replit-nginx-temp
24+
../docker-sed.sh
25+
26+
# replace with appropriate public dir path
27+
sed -i "s/\/opt\/womginx\/public/$ESCAPED_DIR\/public/g" nginx.conf
28+
29+
# add missing mime.types
30+
curl https://raw.githubusercontent.com/nginx/nginx/master/conf/mime.types -o mime.types
31+
sed -i "s/\/etc\/nginx\/mime.types/$ESCAPED_DIR\/replit-nginx-temp\/mime.types/g" nginx.conf
32+
33+
# for some reason, the 1.1.1.1 and 8.8.8.8 dns doesn't work
34+
sed -i "s/1.1.1.1/1.1.1.3/" nginx.conf
35+
36+
# point cache folders to writable directories
37+
rm -rf /tmp/womginx-cache
38+
mkdir /tmp/womginx-cache
39+
CACHE_DIR="\/tmp\/womginx-cache"
40+
sed -i $"s/http {/http {\
41+
client_body_temp_path $CACHE_DIR\/client_body;\
42+
proxy_temp_path $CACHE_DIR\/proxy;\
43+
fastcgi_temp_path $CACHE_DIR\/fastcgi;\
44+
uwsgi_temp_path $CACHE_DIR\/uwsgi;\
45+
scgi_temp_path $CACHE_DIR\/scgi;\
46+
/" nginx.conf
47+
48+
nginx -c $DIR/replit-nginx-temp/nginx.conf -g 'error_log stderr;'

0 commit comments

Comments
 (0)