Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit b927a987 authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

Merge branch 'initial-migration' into 'django'

Initial django migration

Closes #259

See merge request !154
parents 3eadd512 6426adb1
Pipeline #56499 failed with stage
in 51 seconds
# Do not store any migration in the repository for the moment
# (to be removed when we deploy in production)
/allgo/main/migrations/*.py
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
......
......@@ -9,7 +9,8 @@ RUN apt-getq update && apt-getq install \
nginx-light zip gcc python3-dev python3-pip python3-wheel python3-mysqldb \
python-mysqldb python3-crypto gunicorn3 python3-redis python-mysqldb \
python3-crypto python3-natsort python3-aiohttp python3-aioredis supervisor \
python3-ipy python3-django-taggit python3-iso8601 python3-robot-detection
python3-ipy python3-django-taggit python3-iso8601 python3-robot-detection \
python3-sqlparse
COPY requirements.txt /tmp/
RUN cd /tmp && pip3 install -r requirements.txt && rm requirements.txt
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-12-19 15:14
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import main.models
import main.validators
import taggit.managers
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('taggit', '0002_auto_20150616_2121'),
]
operations = [
migrations.CreateModel(
name='AllgoUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sshkey', models.TextField(blank=True, null=True, validators=[main.validators.sshkey_validator])),
('token', models.CharField(default=main.models.generate_token, max_length=32, validators=[main.validators.token_validator])),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='allgouser', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'dj_users',
'verbose_name': 'allgo user',
'verbose_name_plural': 'allgo users',
},
),
migrations.CreateModel(
name='DockerOs',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('version', models.CharField(max_length=255, validators=[django.core.validators.RegexValidator('\\A[\\w][\\w.-]{0,127}\\Z', flags=256, message='Invalid docker tag')])),
('docker_name', models.CharField(max_length=255, validators=[django.core.validators.RegexValidator('\\A[a-zA-Z0-9][a-zA-Z0-9_.-]+\\Z', 'Invalid docker name')])),
],
options={
'db_table': 'dj_docker_os',
},
),
migrations.CreateModel(
name='Job',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now_add=True)),
('param', models.CharField(blank=True, max_length=255, null=True, validators=[main.validators.job_param_validator])),
('datasize', models.IntegerField(blank=True, null=True)),
('version', models.CharField(max_length=255)),
('exec_time', models.IntegerField(blank=True, null=True)),
('access_token', models.CharField(blank=True, max_length=255, null=True, validators=[main.validators.token_validator])),
('state', models.IntegerField(choices=[(0, 'NEW'), (1, 'WAITING'), (2, 'RUNNING'), (4, 'ARCHIVED'), (3, 'DONE'), (5, 'DELETED'), (6, 'ABORTING')], default=0)),
('result', models.IntegerField(choices=[(0, 'NONE'), (1, 'SUCCESS'), (2, 'ERROR'), (3, 'ABORTED'), (4, 'TIMEOUT')], default=0)),
('container_id', models.CharField(blank=True, max_length=64, null=True, validators=[django.core.validators.RegexValidator('\\A[0-9a-f]{64}\\Z', 'Not a docker container id')])),
],
options={
'db_table': 'dj_jobs',
},
),
migrations.CreateModel(
name='JobQueue',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now_add=True)),
('name', models.CharField(max_length=255)),
('timeout', models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])),
('is_default', models.BooleanField()),
],
options={
'db_table': 'dj_job_queues',
},
),
migrations.CreateModel(
name='Quota',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now_add=True)),
('quantity', models.BigIntegerField(blank=True, default=1000, null=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quotauser', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'dj_quotas',
},
),
migrations.CreateModel(
name='Runner',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now_add=True)),
('token', models.CharField(default=main.models.generate_token, max_length=255, unique=True, validators=[main.validators.token_validator])),
('hostname', models.CharField(blank=True, max_length=255, null=True)),
('cpu_count', models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])),
('mem_in_GB', models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1)])),
('last_seen', models.DateTimeField(null=True)),
('open_bar', models.BooleanField(default=False)),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='runneruser', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'dj_runners',
},
),
migrations.CreateModel(
name='Tos',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.URLField(blank=True)),
('version', models.CharField(max_length=32, unique=True)),
],
options={
'db_table': 'dj_tos',
},
),
migrations.CreateModel(
name='UserAgreement',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('tos', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tos', to='main.Tos')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_agreement', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'dj_user_agreement',
},
),
migrations.CreateModel(
name='Webapp',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now_add=True)),
('name', models.CharField(max_length=255, unique=True)),
('description', models.TextField(blank=True, null=True)),
('contact', models.CharField(blank=True, max_length=255, null=True)),
('logo_file_name', models.CharField(blank=True, max_length=255, null=True)),
('logo_content_type', models.CharField(blank=True, max_length=255, null=True)),
('logo_file_size', models.IntegerField(blank=True, null=True)),
('logo_updated_at', models.DateTimeField(blank=True, null=True)),
('default_quota', models.IntegerField(blank=True, null=True)),
('docker_name', models.CharField(max_length=255, unique=True, validators=[django.core.validators.RegexValidator('\\A[a-zA-Z0-9][a-zA-Z0-9_.-]+\\Z', 'Invalid docker name'), django.core.validators.RegexValidator('\\A(root\\Z|sshd\\Z|_)', inverse_match=True, message='This is a reserved name')])),
('readme', models.IntegerField(blank=True, null=True)),
('entrypoint', models.CharField(blank=True, max_length=255, validators=[django.core.validators.RegexValidator('\\A/[/\\w+._-]*[\\w+._-]\\Z', 'Malformatted path')])),
('exec_time', models.IntegerField(blank=True, null=True)),
('private', models.BooleanField(default=1)),
('access_token', models.CharField(blank=True, max_length=255, null=True, validators=[main.validators.token_validator])),
('sandbox_state', models.IntegerField(choices=[(0, 'IDLE'), (1, 'RUNNING'), (2, 'STARTING'), (3, 'START_ERROR'), (4, 'STOPPING'), (5, 'STOP_ERROR')], default=0, null=True)),
('notebook_gitrepo', models.CharField(blank=True, max_length=255, null=True)),
('memory_limit', models.BigIntegerField(null=True, validators=[django.core.validators.MinValueValidator(0)])),
('imported', models.BooleanField(default=False)),
('docker_os', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='webappdockeros', to='main.DockerOs')),
('job_queue', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='webappjobqueue', to='main.JobQueue')),
],
options={
'db_table': 'dj_webapps',
},
),
# webapp ids below 1000 are reserved for webapps imported from the old allgo instance
migrations.RunSQL("ALTER TABLE dj_webapps AUTO_INCREMENT=1000;"),
migrations.CreateModel(
name='WebappParameter',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now_add=True)),
('value', models.CharField(max_length=255, validators=[main.validators.job_param_validator])),
('name', models.CharField(max_length=255)),
('detail', models.CharField(blank=True, max_length=255, null=True)),
('webapp', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='webappparameters', to='main.Webapp')),
],
options={
'db_table': 'dj_webapp_parameters',
},
),
migrations.CreateModel(
name='WebappVersion',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now_add=True)),
('number', models.CharField(max_length=255, validators=[django.core.validators.RegexValidator('\\A[\\w][\\w.-]{0,127}\\Z', flags=256, message='Invalid docker tag'), django.core.validators.RegexValidator('\\Asandbox\\Z', inverse_match=True, message='This is a reserved name')])),
('description', models.CharField(blank=True, max_length=255)),
('docker_image_size', models.FloatField(blank=True, null=True)),
('state', models.IntegerField(choices=[(0, 'SANDBOX'), (1, 'COMMITTED'), (2, 'READY'), (3, 'ERROR'), (4, 'REPLACED'), (5, 'USER'), (6, 'IMPORT')])),
('published', models.BooleanField()),
('imported', models.BooleanField(default=False)),
('webapp', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='webapp', to='main.Webapp')),
],
options={
'db_table': 'dj_webapp_versions',
},
),
migrations.AddField(
model_name='webapp',
name='sandbox_version',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='webappversions', to='main.WebappVersion'),
),
migrations.AddField(
model_name='webapp',
name='tags',
field=taggit.managers.TaggableManager(help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
),
migrations.AddField(
model_name='webapp',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='webappuser', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='runner',
name='webapps',
field=models.ManyToManyField(related_name='webapps', to='main.Webapp'),
),
migrations.AddField(
model_name='quota',
name='webapp',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quotawebapp', to='main.Webapp'),
),
migrations.AddField(
model_name='job',
name='queue',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='job_queue', to='main.JobQueue'),
),
migrations.AddField(
model_name='job',
name='runner',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='runner', to='main.Runner'),
),
migrations.AddField(
model_name='job',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='job',
name='webapp',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='job_webapp', to='main.Webapp'),
),
]
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