Installing Open Event Server
I’m going to walk you through the process of installing Open Event Server and possible issues you might encounter, this will probably be helpful if you’re stuck with it, but most importantly in building some sort of installer as I’ve stated numerous times before.
Requirements for its installation
Debian based distro or unix-like with aptitude package manager
Enough memory and storage, (depends on whether you put the database on your system or not)
Knowledge of UNIX-like systems
First, here are the commands, I tried to make them as easy as a copy-paste but it probably won’t work depending on it, so I’ll talk to you about what each thing does
Ok, let’s start with the beginning, we assume here you know how to open a linux terminal, and that you’re on linux.
Description of commands
Updating the repo
Ok, so let’s start with some assumptions, you’re either on ubuntu, or debian, apt-get is on every debian-based distro, so you can do this on linux-mint as well, but if you’re using other distro you might have to consult with your package manager guide where to get the packets that are needed.
Unfortunately the open-event-server has dependencies and in order to get them we’ve used the package manager of ubuntu, that means some packages might not be possible to be found on every distro, and there is currently not support for that.
Installing git and sudo
apt-get install -y locales git sudo
Ok, let’s also assume you’re on a barebones ubuntu installation, as many people are so let’s work on some very basic requirements that you probably already fulfil, git is not installed by default, so here we install it, we also install sudo, and the -y flag is to avoid being asked for confirmation.
Setting the locales
locale-gen en_US.UTF-8 if [ -z "$LANG" ];then export LANG=en_US.UTF-8;fi
Okay so basically some very bare bones linux distributions don’t have the UTF-8 locale enabled, here we generate it in case it hasn’t, and if the $LANG variable doesn’t exist, then we add the en_US locale.
Really ensuring it works everywhere, especially because once you start installing packages you might get prompted or errors might come up
Cloning the repo
git clone https://github.com/fossasia/open-event-server.git --depth=1
Here we clone the repo with git clone from github.
However we use the –depth=1 flag, that means we only and just only get the latest version, git was designed as a version control tool, not as a source host, so when you clone a project with the purpose of installing it, you’re downloading the whole revision history, and some revision histories can get pretty, pretty large, slowing the download time.
If you’re a contributor and you want to revert some git commits, or you want to debug and see what causes something, then feel free to download everything, but if you’re downloading the git with the purpose to use the software, you really don’t need to download the revision history.
A bit of trivia for those who didn’t know, cd means “Change Directory”, here we’re changing our current directory to open-event-server
#libffi6 libffi-dev apt-get install -y redis-server tmux libssl-dev vim postgresql postgresql-contrib build-essential python3-dev libpq-dev libevent-dev libmagic-dev python3-pip wget ca-certificates python3-venv curl && update-ca-certificates && apt-get clean -y
Okay, here we use apt-get to install redi-server, which is a dependency for open-event, and postgresql, we also download python3 plus some important packets like virtualenv for python3.
In this specific case we’re installing these servers on our server but it doesn’t necessarily have to be that way, if you have an external postgres or redis server you can use that as well.
service redis-server start
We start the redis-server
service postgresql start
We start the postgres service
cp .env.example .env
Virtual python enviroments
python3 -m venv .
We initialize the virtualenv on the current directory, that is .
We activate the virtualenv generated by .venv
pip3 install --no-cache-dir -r requirements.txt
A very clever use of command line pipes, basically psql is the command you use to interact with the database, but it is usually interactive, however on the command line you can very easily pipe typed commands using cat, this is equivalent as if we executed su – postgres -c psql and then typed everything until EOF, so next time you need to automate something that prompts you from input, you can use this!
Also psql won’t generally accept connections from anyone buy postgres, even if you’re root that’s why we’re using su – postgres -c psql which means, run psql as user postgres, you don’t need to use su, if you know how to change users with sudo
python3 create_db.py email@example.com admin
python3 manage.py db stamp head
python3 manage.py runserver
Using docker-compose install both versions
I’ll explain now, how to do it using docker-compose, which concurrently boots both server and frontend.
You will be prompted to add admin account for the v1 server. After you do that just do
(v2 log in settings you can change it in docker-compose.yml)
And that’s it! Way faster than the other way, requires even less code, and almost always succeed), the catch is that you have to have docker installed in your machine