Sign inSign up

greut/webapp-server

By greut

Updated over 9 years ago

Container for group projects

Image
0

1.0K

greut/webapp-server repository overview

WebApp Server

Join the chat at https://gitter.im/HE-Arc/webapp-server

The setup scripts to create development environments for many groups.

Requirements

  • Docker >1.10
  • Python 3 (pip, virtualenv or requests)

Setup

Students

The configuration is done via a TSV file (config/students.tsv). Here is its format:

LastnameFirstnameEmailGroupGithubImage1Team1Image2Team2Comment
BonJean[email protected]INF3jeanjeanLaravelninjasRailsfunky-
BlancYoan[email protected]TeachergreutLaraveladminPythonadmin-

This is how this file is used:

  • Lastname no particular usage
  • Firstname becomes the username
  • Group no particular usage
  • GitHub identifier to download the SSH public keys
  • ImageX stores the information of which container to use
  • TeamX will be the name of the virtual host and identify a container
  • Comment no particular usage
Public keys

To download the public keys, run this python script:

# setup
$ virtualenv3 .
$ . bin/activate
$ pip3 install -r requirements.txt

$ scripts/github_keys.py config/students.tsv config/keys/ <github_username> <password_or_key>

The key is a personal access token to avoid being rate limited by the API.

Docker-compose

Based on the same TSV file, you can generate docker-compose.yml file.

$ scripts/rails_compose.py config/students.tsv docker-compose.yml
Database creation
$ script/bdd.py docker-compose.yml

Containers

If you don't want to use the publicly available containers, you can build them yourself.

# Base container
$ docker-compose -f build.yml build base
# Laravel container
$ docker-compose -f build.yml build laravel
# Python container
$ docker-compose -f build.yml build python
# Rails container
$ docker-compose -f build.yml build rails

Run the base

$ docker run -d \
             -v `pwd`/config \
             -p 80 \
             greut/webapp-server

Run via docker-compose

Create a docker-compose.yml file base on the sample one.

Run the container(s)

docker-compose up -d
Databases

The databases are open the external world, hence we must modify the super admin password. Setting up a good one during the startup won't be as effective as it will be visible from within the containers anyway.

MySQL
Post-setup

Changing MySQL root password because the above value will be passed to each linked containers.

# 5.6
$ mysqladmin -h 127.0.0.1 -u root -p'root' password 's3cur3@P45sw0rd'

# 5.7
$ mysql -h 127.0.0.1 -u root -proot
> SET PASSWORD FOR 'root'@'%' = PASSWORD('s3cur3@P45sw0rd');
PostgreSQL

Changing Postgres password because the above value will be passed to each linked containers.

$ psql -h 127.0.0.1 \
    -U postgres \
    -c "ALTER USER postgres WITH PASSWORD 's3cur3@P45sw0rd';"

Tag summary

Content type

Image

Digest

sha256:5412f5d3e

Size

303.2 MB

Last updated

over 9 years ago

docker pull greut/webapp-server