Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create BOCA Docker #13

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '3.6'
services:
db:
container_name: postgres
image: postgres:9.4
restart: always
env_file:
- docker/production.env
ports:
- 5432:5432
networks:
- boca-net
volumes:
- postgres-data:/var/lib/postgresql/data

boca:
build:
context: .
dockerfile: ./docker/Dockerfile
container_name: boca
restart: always
ports:
- '80:80'
env_file:
- docker/production.env
volumes:
- ./src:/var/www/html
links:
- db
depends_on:
- db
networks:
- boca-net

volumes:
postgres-data: {}

networks:
boca-net:
name: boca-net
24 changes: 24 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM php:5.6-apache-stretch

RUN apt-get update

# Install Postgre PDO
RUN apt-get install -y libpq-dev \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install pdo pdo_pgsql pgsql

# Install and check lsb-release
RUN apt-get install -y lsb-release quota debootstrap schroot

COPY docker/boca.conf /etc/apache2/conf-enabled/boca.conf

ADD docker/lsb-release /etc/lsb-release

#ADD docker/conf.php /var/www/html/private/conf.php

#RUN ./icpc/createbocajail.sh

COPY ./src /var/www/html
WORKDIR /var/www/html

EXPOSE 80
18 changes: 18 additions & 0 deletions docker/boca.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Directory /var/www/html/boca>
AllowOverride Options AuthConfig Limit
Order Allow,Deny
Allow from all
AddDefaultCharset utf-8
</Directory>
<Directory /var/www/html/boca/src/private>
AllowOverride None
Deny from all
</Directory>
<Directory /var/www/html/boca/doc>
AllowOverride None
Deny from all
</Directory>
<Directory /var/www/html/boca/tools>
AllowOverride None
Deny from all
</Directory>
60 changes: 60 additions & 0 deletions docker/conf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
////////////////////////////////////////////////////////////////////////////////
//BOCA Online Contest Administrator
// Copyright (C) 2003-2012 by BOCA Development Team ([email protected])
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////////////
// Last modified 05/aug/2012 by [email protected]

function globalconf() {
$conf["dbencoding"]="UTF8";
$conf["dbclientenc"]="UTF8";
$conf['doenc']=false;

$conf["dblocal"]="false"; // use unix socket to connect?
$conf["dbhost"]="postgres";
$conf["dbport"]="5432";

$conf["dbname"]="bocadb"; // name of the boca database

$conf["dbuser"]="bocauser"; // unprivileged boca user
$conf["dbpass"]="dAm0HAiC";

$conf["dbsuperuser"]="bocauser"; // privileged boca user
$conf["dbsuperpass"]="dAm0HAiC";

// note that it is fine to use the same user

// initial password that is used for the user admin -- set it
// to something hard to guess if the server is available
// online even in the moment you are creating the contest
// In this way, the new accounts for system and admin that are
// eventually created come already with the password set to this
// value. It is your task later to update these passwords to
// some other values within the BOCA web interface.
$conf["basepass"]="boca";

// secret key to be used in HTTP headers
// you MUST set it with any random large enough sequence
$conf["key"]="GG56KFJtNDBGjJprR6ex";

// the following field is used by the autojudging script
// set it with the ip of the computer running the script
// The real purpose of it is only to differentiate between
// autojudges when multiple computers are used as autojudges
$conf["ip"]='local';

return $conf;
}
?>
1 change: 1 addition & 0 deletions docker/lsb-release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DISTRIB_CODENAME=stretch
5 changes: 5 additions & 0 deletions docker/production.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BOCA_DOMAIN=localhost
POSTGRES_HOST=postgres
POSTGRES_USER=bocauser
POSTGRES_PASSWORD=dAm0HAiC
POSTGRES_DB=bocadb
21 changes: 10 additions & 11 deletions src/private/conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@
// Last modified 05/aug/2012 by [email protected]

function globalconf() {
$conf["dbencoding"]="UTF8";
$conf["dbclientenc"]="UTF8";
$conf['doenc']=false;
$conf["dbencoding"]="UTF8";
$conf["dbclientenc"]="UTF8";
$conf['doenc']=false;

$conf["dblocal"]="false"; // use unix socket to connect?
$conf["dbhost"]="localhost";
$conf["dbport"]="5432";
$conf["dblocal"]="false"; // use unix socket to connect?
$conf["dbhost"]="localhost";
$conf["dbport"]="5432";

$conf["dbname"]="bocadb"; // name of the boca database

$conf["dbuser"]="bocauser"; // unprivileged boca user
$conf["dbpass"]="dAm0HAiC";
$conf["dbpass"]="dAm0HAiC";

$conf["dbsuperuser"]="bocauser"; // privileged boca user
$conf["dbsuperpass"]="dAm0HAiC";
$conf["dbsuperpass"]="dAm0HAiC";

// note that it is fine to use the same user
// note that it is fine to use the same user

// initial password that is used for the user admin -- set it
// to something hard to guess if the server is available
Expand All @@ -47,8 +47,7 @@ function globalconf() {

// secret key to be used in HTTP headers
// you MUST set it with any random large enough sequence
$conf["key"]="GG56KFJtNDBGjJprR6ex";

$conf["key"]="GG56KFJtNDBGjJprR6ex";

// the following field is used by the autojudging script
// set it with the ip of the computer running the script
Expand Down