Skip to content

Instantly share code, notes, and snippets.

@mitio
Last active July 28, 2016 15:03
Show Gist options
  • Save mitio/13e3d2ded240e434cbd5 to your computer and use it in GitHub Desktop.
Save mitio/13e3d2ded240e434cbd5 to your computer and use it in GitHub Desktop.
Europe Code Week Infrastrucute Notes

EU Code Week Infrastructure

Domain

The domain is serviced by tsohost.co.uk (DNS only, no hosting). It's paid for until Oct 31, 2016. We also own code-week.eu.

Access to tsohost.co.uk have the following people:

Email

Incoming

Our official email is info@codeweek.eu. It's just a forward to europecodes@gmail.com. There's also a forward from contact@codeweek.eu to the same Gmail account.

The email forwarding is handled by TsoHost.

Outgoing

Outgoing email is handled by SendGrid. We have a free account there. Access details have been provided to Alessandro. Dimitar also has these details.

The europecodes@gmail.com account has been configured with info@codeweek.eu as a default sender, using the SendGrid's SMTP.

The dynamic website also sends emails on behalf of info@codeweek.eu, using SendGrid.

Limitations

The fre SendGrid account has the following limitations:

  • 12k emails per month
  • 400 emails per day

Static website - http://codeweek.eu

Hosted on GitHub pages: the static website is built in Jekyll and automatically updated from the repo (master branch) on each push. Repo: https://github.com/codeeu/codeeu.github.io

Access is granted to everyone in the CodeEU GitHub organization.

  • Tumblr with a custom theme (HTML & CSS): Steffi and Yasemin now have admin rights and can add others.

Events website - http://events.codeweek.eu

It's a Django app (written in Python) which uses MySQL as a DB and runs on a small VPS in DigitalOcean. Repo: https://github.com/codeeu/coding-events

The VPS has a prepaid credit of about $200, donated by Google (as of Nov 13 2015). The account costs $5/month, which means it is prepaid for about 40 months, or till mid 2019.

VPS info: IP: 178.62.225.184, 512 MB Ram, 20GB SSD Disk, located in Amsterdam 3, OS: Ubuntu 14.04 x64

  • DigitalOcean VPS for hosting the events website in Django: Dimitar and Alessandro have the passwords to the DigitalOcean admin.

  • The following people have SSH root access to the server:

  • AWS for hosting static content for the events website. AWS info is present in the config file on the server (~/deploy/settings_local.py). The account is owned by europecodes@gmail.com.

  • Django admin (http://events.codeweek.eu/admin/): there is an "admin" user and Alessandro and Dimitar have the password. However, any existing user there can be made an admin, via the admin itself, by locating the user in the Users section, entering "edit" mode and turning on the "Staff status" and "Superuser status" flags. (Screenshot)

Deploying the events website

Semi-automatic

To deply the dynamic events website, push to the repo (after making sure all tests are passing locally) and then execute the following script as root on the VPS:

./deploy-latest-coding-events

Manual

The script above is a really simple Bash script which makes a bunch of things for you. If you want to deploy manually, check out the source of the script, or read below.

Shared by someone who worked on the website before:

the currently "active" version is linked in the home dir of the codeeu user.

the application is run from /home/codeeu/coding-events individual versions are cloned and checked out into appropriate dirs (currently /home/codeeu/coding-events_v1.1.4)

when upgrading to a new version, clone a new copy and checkout the version you need, adjust configuration files (it will be easier this way than to set ENV variables), stop apache, delete the existing link, create a symbolic link to the new version and start apache. of course, any changes that should be made to the DB (migrations and stuff) should be done too

I've started on some scripts for automating deployments, but they aren't nearly stable enough to be used (actually, don't really remember in what state they were, didn't really have the time)

no files should be pushed from the server to the repo... ever!

the apache config is found in /etc/apache2/sites-available/codeeu.conf (linked to /etc/apache2/sites-enabled/000-codeeu.conf) it uses mod_wsgi

Deploy scheme recommended for smaller changes:

ssh root@events.codeweek.eu

Switch to the codeeu user:

su - codeeu

Activate the Pyhon’s virtualenv for the site:

workon v1.1.4

Then:

cd coding-events
git pull
pip install -r server-requirements.txt
./manage.py collectstatic --noinput
./manage.py compress
./manage.py migrate

Then, as root:

service apache2 restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment