Ubuntu portable script
How to run server on Ubuntu?
Other options:
- If you want to run it on windows, you should read how to run the server on Windows
- If you want to run simple version of linex server, you should read how to run the server on Linux (simple version)
I prepared to you this script, so you can run it on ubuntu server.
The fastest way to run this one line and follow instructions (here codenjoy
- is a folder and /srv
- is the place where it will be installed):
sudo su -c "bash <(wget -qO- https://raw.githubusercontent.com/codenjoyme/codenjoy-portable-linux/master/install.sh) /srv codenjoy" root
or do it step by step:
- [Optional] Please use dedicated server for every 300-500 participants or VPS if number of participants is less then 50.
- make sure nginx on host machine is disabled.
- this version uses docker-composer and docker. If docker/docker-compose are not installed we will do it for you by running this stuff
sudo bash setup-docker.sh
docker-compose --version
- copy all files from this subrepo
to
/srv/codenjoy
server folder asroot
user - edit
.env
file or runbash env-update.sh
to interactive update- [WARNING] please use only alphanumericals characters [A-Za-z0-9] for passwords. Other characters due to escaping/unescaping may lead to errors in the application.
CONFIG=true
true alwaysBUILD_SERVER=true
build server sourcesBUILD_BALANCER=false
build balancer sourcesBUILD_CLIENT_RUNNER=false
build websocket client runner sourcesTIMEZONE=Europe/Kiev
your timezone inside docker containers (for valid time in logs)CODENJOY_VERSION=1.1.3
version of docker images that will be after buildGIT_REPO=https://github.com/codenjoyme/codenjoy.git
git repository you want to buildMAINTAINER_NAME=FirstName_LastName
Maintainer name (used inside git and docker containers)[email protected]
Maintainer email (used inside git and docker containers)REVISION=master
revision inside repository (to use master, branch name or revision id)SKIP_TESTS=true
this will be in the http://your-server.com/codenjoy-contest/CODENJOY_CONTEXT=codenjoy-contest
context of codenjoy server applicationBALANCER_CONTEXT=codenjoy-balancer
context of codenjoy builder applicationCLIENT_RUNNER_CONTEXT=codenjoy-client-runner
context of codenjoy websocket client runner applicationGAME=tetris,mollymage,knibert
games to build- comma separated for several games.
- if
ALL
- all games
SPRING_PROFILES=postgres,debug
spring profiles, comma separatedsqlite
for the lightweight database (<50 participants)postgres
for the postgres database (>50 participants)trace
for enable log.debugdebug
if you want to debug js files (otherwise it will compress and obfuscate)yourgame
if you added your custom configuration to the game insideCodingDojo\games\yourgame\src\main\resources\application-yourgame.yml
PAGE_HELP_LANGUAGE=en
- `` for default (russian) version of how to play manuals
en
for english version of how to play manuals (we will find manual here/codenjoy-contest/resources/help/game-en.html
)
SSL=false
true - if you want to use https instead of http (please copy certificate here portable/linux-docker-compose/ssl-cert)DOMAIN=false
true - if you want use domain instead of IPOPEN_PORTS=false
true - if you want debug all applications inside containers and want to enable port mapping (ports settings are bellow)BASIC_AUTH=false
true - if you want to set basic authorization for all game server to disable site before start contestBASIC_AUTH_LOGIN=codenjoy
basic authorization loginBASIC_AUTH_PASSWORD=secureBasicAuthPassword
basic authorization password[email protected]
this is user namr for admin page, please keep it secureADMIN_PASSWORD=secureAdminPassword
this is password for admin page, please keep it secure- if you select postgres database - you should use this settings
CODENJOY_POSTGRES_DB=codenjoy
CODENJOY_POSTGRES_USER=codenjoy
CODENJOY_POSTGRES_PASSWORD=securePostgresDBPassword
CODENJOY_POSTGRES_PORT=8004
port for codenjoy, works ifOPEN_PORTS
is true
- please set true if you want to use wordpress at
http://your-server.com/
WORDPRESS=false
WORDPRESS_MYSQL_ROOT_PASSWORD=secureWordpressRootDBPassword
WORDPRESS_MYSQL_DATABASE=wordpress
WORDPRESS_MYSQL_USER=wordpress
WORDPRESS_MYSQL_PASSWORD=secureWordpressDBPassword
WORDPRESS_PORT=8006
port for wordpress application, works ifOPEN_PORTS
is trueWORDPRESS_MYSQL_PORT=8005
port for wordpress database, works ifOPEN_PORTS
is true
- true if you want to setup pgadmin for postgres on this server
PGADMIN=false
PGADMIN_DEFAULT_PASSWORD=securePGAdminPassword
[email protected]
PGADMIN_PORT=8007
port for pgadmin, works ifOPEN_PORTS
is true
- domain settings (if
DOMAIN=false
please ignore this option) (uses in nginx setup) SERVER_IP=79.143.176.243
your IPSERVER_DOMAIN=your-domain.com
your domain- true if you want to run load websocket client runner on this server
CLIENT_RUNNER=false
CLIENT_RUNNER_PORT=8009
port for this application, works ifOPEN_PORTS
is trueCLIENT_RUNNER_SOLUTION_FOLDER_PATH=./solutions
sources folder inside application forlder (in docker contsiner)CLIENT_RUNNER_SOLUTION_FOLDER_PATTERN=dd-MM-yyyy'T'HH_mm_ss
sources timestamp folder patternCLIENT_RUNNER_CODENJOY_URL_REGEX=^http://domain.com/codenjoy-contest/board/player/([\\w]+)\\?code=([\\w]+)
websocket client connection url pattern
- true if you want to run load balancer on this server
BALANCER=false
BALANCER_PORT=8001
port for balancer backend, works ifOPEN_PORTS
is trueBALANCER_SMS_ENABLED=false
enable sms registration verificationBALANCER_GAME_SERVERS=game1.your.domain.com,game2.your.domain.com,game3.your.domain.com
list of game servers, comma separated, works ifBALANCER
is trueBALANCER_GAME_ROOM=10
players per one roomBALANCER_GAME_START_DAY=2020-03-01
game tournament start dayBALANCER_GAME_END_DAY=2020-03-31
game tournament end dayBALANCER_GAME_EXCLUDED_DAYS=2020-03-06,2020-03-07
game tournament weekends (comma separated value)BALANCER_GAME_FINALISTS_COUNT=10
day finalists countBALANCER_GAME_FINAL_TIME=19:00
game tournament end time
- balancer frontend settings list
BALANCER_FRONTEND=false
BALANCER_FRONTEND_PORT=8003
port for balancer frontend, works ifOPEN_PORTS
is trueNODE_PATH=src/
please do not change it, I don't know what it is )GENERATE_SOURCEMAP=false
please do not change it, I don't know what it is )REACT_APP_API_SERVER=https://your-domain.io
Link to balancer backend server (to usehttps
whenSSL=true
)REACT_APP_GAME=mollymage
game to choose (please select only one same game here and in theGAME
property)REACT_APP_EVENT_START=2020-03-01T07:00:00.000Z
game tournament start day/timeREACT_APP_EVENT_END=2020-03-31T17:00:00.000Z
game tournament end day/timeREACT_APP_EVENT_LINK=http://your-event.io
Link to eventREACT_APP_JOIN_CHAT_LINK=https://your-chat.io
Link to chatREACT_APP_GA_ID=UA-123456789-1
REACT_APP_FB_PIXEL_ID=123456789012345
facebook pixelREACT_APP_IS_SECURE=true
please set true ifSSL=true
REACT_APP_IS_UNAVAILABLE=false
please set true if application is unavaliableREACT_APP_EVENT_START_DATE=01.03.2020
game tournament start day (info page only)REACT_APP_EVENT_END_DATE=31.03.2020
game tournament end day (info page only)REACT_APP_EVENT_REGISTER_END_DATE=31.03.2020
game tournament registration end day (info page only)REACT_APP_EVENT_START_TIME=09:00
game tournament start time (info page only)REACT_APP_EVENT_FINAL_TIME=19:00
game tournament final time (info page only)REACT_APP_EVENT_FINALISTS_COUNT=10
day finalists count (info page only)[email protected]
Organizer contact emailREACT_APP_SCORES_UPDATE_TIMEOUT=10000
Time in mills to update scores leaderboard page
CODENJOY=true
if you want to run codenjoy app on this server (only one appBALANCER
|CODENJOY
should be)CODENJOY_PORT=8002
port for codenjoy application, works ifOPEN_PORTS
is trueCODENJOY_GAME_AI=true
If you want to launch AI bot in the room with the first participant. So the participant will not be bored to play himself.CODENJOY_GAME_SAVE_AUTO=true
If you want to save all scores (backup) every 30 ticks.CODENJOY_GAME_SAVE_LOAD_ON_START=true
If you want to load all scores from saves during server starting.CODENJOY_XFRAMEALLOWEDHOSTS=domain.com
Domain ot IP of this server.CODENJOY_PAGE_MAIN_UNAUTHORIZED=true
If you allow access to the main page with the ability to view server games for an unregistered user please settrue
here, otherwise there will be a redirect to login
- build and start server by command (everytime when you committed new changes)
sudo bash rebuild.sh
- restart server if need
sudo bash up.sh
- now you can press Ctrl-F5 (for clean browser cache) and register http://127.0.0.1:8080/codenjoy-contest
Useful commands
- how to get logs from docker images?
sudo bash log.sh nginx
sudo bash log.sh codenjoy_db
sudo bash log.sh codenjoy_server
- where is application logs?
./logs/
- where is database?
./materials/
- where is applications?
./applications/
- where is config (nginx / codenjoy)? Be carefull this folder will update every time you run any command this manual
./config/
- where is my ssl certificates?
./ssl-cert/
./config/nginx/ssl.conf
- how to backup/restore postgres database?
cd ./materials & sudo bash backup.sh
cd ./materials & sudo bash restore.sh
- how to check all user saves?
cd ./materials & sudo bash get-user-saves.sh "Stiven Pupkin"
- how to get all users?
cd ./materials & sudo bash get-users.sh
- hot to check current git revision?
cd ./applications & sudo bash check-revision.sh
- if you run any command please create bash script and share it with us - it can be useful for us.
echo "Be LAZY write script"