Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
shadowban-eu-backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
shadowban-eu-backend
Commits
5250af43
Commit
5250af43
authored
Dec 14, 2020
by
Raphael Beer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor: DRY starter scripts
parent
a3693c84
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
30 deletions
+39
-30
.env.example
.env.example
+8
-4
.gitignore
.gitignore
+2
-2
README.md
README.md
+14
-11
docker-entry.sh
docker-entry.sh
+15
-1
profile.sh
profile.sh
+0
-12
No files found.
.env.example
View file @
5250af43
...
...
@@ -3,8 +3,12 @@ COOKIE_DIR=./.htcookies
LOG_FILE=./logs/results.log
DEBUG_FILE=./logs/debug.log
PORT=4040
HOST=
127.0.0.1
MONGO_HOST=
127.0.0.1
HOST=
localhost
MONGO_HOST=
localhost
MONGO_PORT=27017
MONGO_DB=tester
TWITTER_AUTH_KEY=GRAPHQL_KEY
MONGO_DB=shadowban-testing
MONGO_USERNAME=root
MONGO_PASSWORD=5X-rl[(EMdJKll1|qMDU}5xY<t?F.UEo
TWITTER_AUTH_KEY=AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA
CORS_HOST=http://localhost:3000
GUEST_SESSIONS=3
.gitignore
View file @
5250af43
...
...
@@ -54,7 +54,6 @@ node_modules
.env
.env.*
!.env.example
!.env.docker
.ht*
# starter scripts with possibly sensitive data
...
...
@@ -62,5 +61,6 @@ dev.sh
start.sh
restart.sh
#
venv
#
python misc
.venv
mprofile_*.dat
README.md
View file @
5250af43
Pull
```
git clone https://github.com/shadowban-eu/shadowban-eu-backend && cd shadowban-eu-backend
```
### Install/Run
Add config
```
cp ~/configs/.env.development|production ./
cp ~/configs/.htaccounts
```
bash
$
git clone https://github.com/shadowban-eu/shadowban-testing ./shadowban-testing
;
cd
$_
$
./docker-entry.sh .env.example
# takes any .env file
```
Run
`./run.sh development|production`
### Memory Profiling
Using
[
memory-profiler
](
https://pypi.org/project/memory-profiler/
)
to debug memory usage:
See
[
.env.example
](
https://github.com/shadowban-eu/shadowban-eu-backend/blob/dev/.env.example
)
for .env variables
```
bash
# When env vars are already set
$
./docker-entry.sh mprof
# Otherwise, read from file
$
./docker-entry.sh .env.example mprof
# Passes remaining arguments to mprof (set interval to 5s)
$
./docker-entry.sh .env.example mprof
-T
5
```
docker-entry.sh
View file @
5250af43
#!/usr/bin/env bash
if
[
-f
$1
]
;
then
echo
"Using provided .env file:
$1
"
export
$(
cat
$1
| xargs
)
shift
fi
echo
"Starting server..."
echo
"--account-file
$ACCOUNT_FILE
"
echo
"--cookie-dir
$COOKIE_DIR
"
...
...
@@ -16,7 +22,15 @@ echo "--twitter-auth-key --REDACTED--"
echo
"--cors-allow
$CORS_HOST
"
echo
"--guest-sessions
$GUEST_SESSIONS
"
python3
-u
./backend.py
\
CMD
=
"python3 -u ./backend.py"
if
[
"
$1
"
==
"mprof"
]
;
then
shift
CMD
=
"mprof run
$@
./backend.py"
echo
-e
"
\n
Recording memory profile
\n
"
fi
$CMD
\
--account-file
$ACCOUNT_FILE
\
--cookie-dir
$COOKIE_DIR
\
--log
$LOG_FILE
\
...
...
profile.sh
deleted
100755 → 0
View file @
a3693c84
mprof run ./backend.py
\
--account-file
./.htaccounts
\
--cookie-dir
./.htcookies
\
--port
8080
\
--host
0.0.0.0
\
--mongo-host
127.0.0.1
\
--mongo-port
27017
\
--mongo-db
tester
\
--mongo-username
$MONGO_USERNAME
\
--mongo-password
$MONGO_PASSWORD
\
--twitter-auth-key
AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA
\
--guest-sessions
$GUEST_SESSIONS
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment