Menu

Tree [dee968] master /
 History

HTTPS access


File Date Author Commit
 css 2024-07-23 Rodion Rodion [575dd2] Site customized and running
 ctl 2024-08-09 Rodion Rodion [dee968] Basic interpreter and local run
 fragments 2024-08-09 Rodion Rodion [dee968] Basic interpreter and local run
 img 2024-07-23 Rodion Rodion [575dd2] Site customized and running
 js 2024-08-09 Rodion Rodion [dee968] Basic interpreter and local run
 layouts 2024-07-01 Rodion Rodion [a99576] htaccess files and url rewriting
 module 2024-08-09 Rodion Rodion [dee968] Basic interpreter and local run
 pages 2024-08-09 Rodion Rodion [dee968] Basic interpreter and local run
 .htaccess 2024-07-23 Rodion Rodion [575dd2] Site customized and running
 Dockerfile 2024-07-01 Rodion Rodion [a99576] htaccess files and url rewriting
 LICENSE.txt 2024-07-20 Rodion Rodion [6850f2] Licenses and customization
 README.md 2024-07-22 Rodion Rodion [b08a21] Solvers and Solution view
 conf.php 2024-07-22 Rodion Rodion [b08a21] Solvers and Solution view
 dbinit.sql 2024-07-21 Rodion Rodion [b7fb7f] Wiki functionality
 docker-build.sh 2024-06-27 Rodion Rodion [6508f6] Framework files allowing to display main page
 docker-run.sh 2024-06-27 Rodion Rodion [6508f6] Framework files allowing to display main page
 index.php 2024-06-27 Rodion Rodion [6508f6] Framework files allowing to display main page
 sqlexec.php 2024-07-08 Rodion Rodion [648aaa] Task submission works
 taskinit.sql 2024-07-21 Rodion Rodion [840405] Minor fixes around tags

Read Me

CodeAbbey - opensource initiative

It is a website with programming exercises - you can quickly deploy it on your own server (even free hosting) - and
build something like ProjectEuler or Rosalind.Info. Actually, it is more powerful as problems you create
will include data generator / checker code, so that users are every time provided with newly generated, random set
of data (and of course, another answer is expected every time).

This project started as https://www.codeabbey.com
in September of 2013 and is now (as of summer 2024) moving to opensource, so that everyone can quickly setup
similar website for personal coding puzzle collection, or for school, enterprise company needs (e.g. for
interviewing, screening candidates).

Quick video-demo: deploy CodeAbbey site at free web-hosting

Instructions

Here are two parts - one about how it works and another about how to run it. Consult them in any order according
to your needs.

How it works

To make studying the project easier it could be done in steps. These steps are represented
by certain points (branches) in repository, as more and more functionality are added.

  • Step 1 - framework - at this point
    here is bare minimum of files, or "framework" which work for page loading. Refer to README
    in this version to learn more.
  • Step 2 - users - now database is enabled
    and functionality of registering users, login, logout is added.
  • Step 3 - htaccess - about some important
    features which are configured outside PHP code
  • Step 4 - tasks - pages for creating, editing,
    listing and viewing tasks.
  • Step 5 - submit - submission and checking.
  • Step 6 - userrank - user profile and ranking pages.
  • Step 7 - sync - no critical features added,
    mainly some improvements due to syncronizing codebase with existing website.
  • Step 8 - customization minor tweaks and
    rearrangements to help you customize the site elements (project name, title, author, fragments etc)
  • Step 9 - task tags task tags and "volumes"
  • Step 10 - wiki "wiki" pages support
  • Step 11 - solvers about viewing solutions

Step 11 - Solvers and Solutions viewing

Here we add previously skipped files which allow to see list of people who solved the specific problem
and also the page to view solutions itself. Surprisingly this logic is pretty confusing due to various conditions
when allow or not allow to see solutions so here could be still mistakes or duplications (some were fixed now):

  • to see solution one should solve the given task before
  • thus user needs to be logged in
  • solutions to challenges could not be seen though
  • solution owner and admin can see solution anyway
  • there is an opportunity to see solution by shareable link in 1 week period (no login required, no checks)

How to run

This is a typical PHP + MySQL application, so you need an http-server with PHP interpreter and MySQL (MariaDB).

There are THREE ways to launch this zoo relatively easily.

Docker

Docker is something resembling virtual-machine (but not exactly) widely used in industry. We describe
the content of "containers" we need in a file (or few) and docker prepares everything. You'll need to install
docker itself (there could be subtle steps like setting user group in linux but generally it is not much
complicated) - this is available in linux, windows and OsX. Then run files docker-build.sh to build an
image containing our Apache2 httpd + PHP server with MariaDB in one. then docker-run.sh to launch container
from it. If all is fine, the site should be ready at http://localhost:8080/

To initialize database: open http://localhost:8080/sqlexec.php and copy-paste content of the file dbinit.sql into the textarea, then click exec.

Free (Shared) Hosting

Pick some free hosting, for example AwardSpace / AtWebpages and simply copy files there. If you'll get error because RewriteRules exist in .htaccess while
the server has no rewrite module enabled, and you can't control it - just comment these lines.

Then you'll get the site running on the web. There could be some limitations about some auxiliary functions
(e.g. 3rd party login etc) but that's not much important for you now (such things anyway require efforts to setup).

Setup database: this is done with control-panel of the hosting - generally you are provided
with some database name and connection info and create user here via web-interface. So then you
need to put corresponding settings into conf.php file and populate database with tables, for
which use the content of dbinit.sql except first few lines (no user or db creation) with
some query running tool in the web-interface.

LAMPP / XAMPP

With this approach you'll find software package (by the name XAMPP probably) which contains HTTP server, PHP and MySQL
inside and set up on your machine. It is not very difficult also and in some respects more handy than with docker.
Then copy files there and setup database. For managing database there should be PHPMyAdmin
web tool in the LAMPP packet - make use of it and generally follow instructions for
shared hosting given above.

Customization

It is natural that after your deploy succeeds and you see the website running with joy, you may
want to change its name, title and some general fragments. This is what we call "customization".
What makes customization a bit tedious, is that you want to keep compatibility with the original
sources, so that when "upstream" repository updates, you can update your site in as simple way as
possible.

This means that simply starting tweaking all files carelessly may be not exactly what you want -
with the first update you'll inadvertently override half of your changes!

We are trying to simplify this for you and by now this is achieved with the following:

  • you need not modify file conf.php in the root, instead just drop along it the similar file
    named cust_conf.php and put your real secrets and settings here (feel free to remove all
    lines that do not differ, these files are loaded one after another); of course you should
    never commit your file with real secrets to any public repository etc!
  • find settings with project name, webpage general title, site author etc in the conf.php -
    and update them to your taste and needs (of course, again do it in cust_conf.php).
  • if you want to replace some fragments files, just copy them with some new name (e.g.
    copy main_bottomnote.html to main_bottomextra.html, then go to configuration file
    and find array custFrag, put replacement here, e.g. 'main_bottomnote' => 'main_bottomextra',
    then make any changes in this new fragment file instead; also you can use empty name if you
    want some fragment to be removed (by default it happens to adblock fragment).