Commit a852c09b authored by BAIRE Anthony's avatar BAIRE Anthony

django container_init: initialise the db from scratch

This commit removes the calls to the 'migration.sh' script that
did a full a import of the rails db (rails apps will be imported
on-demand)

The django db is now initialised from scratch, using the db_seed command
parent 5f1166d6
......@@ -128,7 +128,7 @@ To set up the development environment, run:
**Note** by default `bootstrap` works on all containers. It is possible
to give an explicit list of containers instead. Example:
<pre>
./bootstrap dev-mysql dev-rails
./bootstrap dev-mysql dev-django
</pre>
4. for convenience, you may want to alias `docker-compose` as `fig` (because
......@@ -138,6 +138,11 @@ To set up the development environment, run:
alias fig=docker-compose
</pre>
5. after bootstrap, in development the db is initialised with three users (all with the password `allgo`):
- `admin@localhost` which is superuser
- `devel@localhost` which is the owner of a webapp named `sleep`
- `guest@localhost`
### Common commands
......
......@@ -9,7 +9,22 @@ wait-mysql
mkdir -p /vol/cache/allgo
# import the rails database
/bin/bash /opt/allgo/tools/migration.sh -e allgo allgo "$ENV-mysql" allgo
/bin/bash /opt/allgo/tools/migration.sh -d allgo allgo "$ENV-mysql" allgo
/bin/bash /opt/allgo/tools/migration.sh -m allgo allgo "$ENV-mysql" allgo
mysql_cmd() {
mysql -uallgo -pallgo -h"$ENV-mysql"
}
# reset the database (if we are in development)
if [ "$ENV" = dev ] ; then
echo "DROP DATABASE IF EXISTS allgo;" | mysql_cmd
fi
# create the database
echo "CREATE DATABASE allgo CHARACTER SET 'utf8';" | mysql_cmd
# create the tables (apply the migrations)
python3 manage.py migrate
# seed the db
python3 manage.py db_seed
-- NOTE: this script is no longer used at container init
-- (to be resurrected when we implement on-demand import of old allgo webapps)
--
-- Migrate user data
--
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment