kaleidos-ventures / taiga-scripts

Taiga deploy scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker support

canercandan opened this issue · comments

Anybody interested porting Taiga to a docker image ?

Is related to issue opened on taiga-front: kaleidos-ventures/taiga-vagrant#4

We does not have official plans for port them to docker, but I have personal tests with docker that currently is not working state but I will upload them in my first free time (maybe "tomorrow")

We have official plans unify this scripts with taiga-vagrant.

@niwibe thanks for your answer. I already tested a naive version using a ubuntu:14.04 image and executing the script-server, but there are some configurations missing like the ones used by circus due to the use of a non existing /home/$USER path. In addition there are some steps that can be removed such as ones installing DB, redis and rabbitmq since there were already efficiently dockerized. We only need to link them.

$ docker run -i -t -p 8000:8000 -e HOME=/root ubuntu:14.04 bash
root@taiga:/# apt-get update
[...]
root@taiga:/# apt-get install git
[...]
root@taiga:/# adduser --gecos "" --disabled-password taiga
[...]
root@taiga:/# echo taiga:taiga | chpasswd
root@taiga:/# adduser taiga sudo
[...]
root@taiga:/# su - taiga
taiga@taiga:~$ git clone https://github.com/taigaio/taiga-scripts.git
taiga@taiga:~$ cd taiga-scripts/
taiga@taiga:~/taiga-scripts$ bash setup-server.sh
taiga@taiga:~/taiga-scripts$ bash setup-server.sh
~ ~/taiga-scripts
~/taiga-scripts
Scheme (default http): 
Hostname (default: localhost:8000): 
Installing taigaio with user=taiga host=localhost:8000 scheme=http
[sudo] password for taiga: 
[...]
[?] May bower anonymously report usage statistics to improve the tool over time? No
[...]
Successfully installed djangorestframework Django django-picklefield django-sampledatahelper gunicorn psycopg2 pillow pytz amqp djmail django-pgjson djorm-pgarray django-jinja jinja2 pygments django-sites Markdown fn diff-match-patch requ
ests easy-thumbnails celery redis enum34 markupsafe billiard kombu anyjson
Cleaning up...
Trying import local.py settings...
Monkey patching...
Traceback (most recent call last):
  File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/django/db/backends/__init__.py", line 133, in ensure_connection
    self.connect()
  File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/django/db/backends/__init__.py", line 122, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 134, in get_new_connection
    return Database.connect(**conn_params)
  File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
[...many more like the above...]
[...]
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for libc-bin (2.19-0ubuntu6) ...
 * Restarting nginx nginx                                                                                                                                                                                                              [ OK ] 
taiga@taiga:~/taiga-scripts$ curl http://localhost:8000
curl: (7) Failed to connect to localhost port 8000: Connection refused

Hacks begin:

taiga@taiga:~$ sudo service postgresql start
 * Starting PostgreSQL 9.3 database server
taiga@taiga:~$ sudo kill 12577 # circusd
taiga@taiga:~$ sudo /usr/local/bin/circusd --daemon /home/$USER/conf/circus.ini
taiga@taiga:~$ cd taiga-back/
taiga@taiga:~/taiga-back$ workon taiga
(taiga)taiga@taiga:~/taiga-back$ python manage.py migrate --noinput
[...]
  File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: FATAL:  role "taiga" does not exist

(taiga)taiga@taiga:~/taiga-back$ sudo -u postgres createuser --superuser $USER
(taiga)taiga@taiga:~/taiga-back$ sudo -u postgres createdb $USER
(taiga)taiga@taiga:~/taiga-back$ python manage.py migrate --noinput                                                                                                                                                                           
Trying import local.py settings...
Monkey patching...
[...]
  Applying votes.0001_initial... OK
  Applying wiki.0001_initial... OK
(taiga)taiga@taiga:~/taiga-back$ python manage.py loaddata initial_user
[...]
(taiga)taiga@taiga:~/taiga-back$ python manage.py loaddata initial_project_templates
[...]
(taiga)taiga@taiga:~/taiga-back$ python manage.py loaddata initial_role
[...]
(taiga)taiga@taiga:~/taiga-back$ nohup python manage.py runserver 0.0.0.0:8000 &                                       
[1] 16495
(taiga)taiga@taiga:~/taiga-back$ deactivate
(taiga)taiga@taiga:~/taiga-back$ curl localhost:8000 | head -n 5
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2373    0  2373    0     0   268k      0 --:--:-- --:--:-- --:--:--  289k

<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">

+1 for a docker image.

thx!!

ShutIt module for docker build available here, based on the above:

https://github.com/ianmiell/shutit/tree/master/library/taigaio
https://github.com/ianmiell/shutit/blob/master/library/taigaio/taigaio.py

Can anyone confirm it's working/correct?

Improved version pushed, but still get this error:

Trying import local.py settings...
Monkey patching...
Installed 1 object(s) from 1 fixture(s)
Trying import local.py settings...
Monkey patching...
Installed 2 object(s) from 1 fixture(s)
Trying import local.py settings...
Monkey patching...
Installed 0 object(s) from 0 fixture(s)
Trying import local.py settings...
Monkey patching...
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/django/core/management/init.py", line 385, in execute_from_command_line
utility.execute()
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/django/core/management/init.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(_args, *_options.dict)
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(_args, *_options)
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/django/db/transaction.py", line 394, in inner
return func(_args, *_kwargs)
File "/home/taiga/taiga-back/taiga/projects/management/commands/sample_data.py", line 117, in handle
self.users.append(self.create_user(counter=x))
File "/home/taiga/taiga-back/taiga/projects/management/commands/sample_data.py", line 351, in create_user
full_name = full_name or "{} {}".format(self.sd.name('es'), self.sd.surname('es', number=1))
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/sampledatahelper/mixins/localized_mixin.py", line 33, in name
return Name().generate(self, locale, number, as_list)
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/sampledatahelper/l10n/names.py", line 43, in generate
names = self.get_names(locale)
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/sampledatahelper/l10n/names.py", line 24, in get_names
self.load_locale(locale)
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/site-packages/sampledatahelper/l10n/names.py", line 19, in __load_locale
Name.data[locale] = json.load(fd)
File "/usr/lib/python3.4/json/__init
.py", line 265, in load
return loads(fp.read(),
File "/home/taiga/.virtualenvs/taiga/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3925: ordinal not in range(128)
~ ~/taiga-scripts
~/taiga-scripts
Downloading/unpacking circus

This seems related to encoding of your image.
On my experiments I have used this:

RUN echo "LANG=en_US.UTF-8" > /etc/default/locale
RUN echo "LC_MESSAGES=POSIX" >> /etc/default/locale
RUN echo "LANGUAGE=en" >> /etc/default/locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8

We've got a working docker image - https://registry.hub.docker.com/u/imiell/taigaio/

docker pull imiell/taigaio
docker run -i -t -p 127.0.0.1:8000:8000 -p 127.0.0.1:8001:8001 imiell/taigaio bash -c '/root/start_postgres.sh && /root/start_taiga.sh && echo READY! && sleep 3000d'

and visit localhost:8000 in your browser. Easy as that.

You can build it yourself with shutit:

git clone https://github.com/ianmiell/shutit.git
cd shutit/library/taigaio/bin
./build.sh

(uses this code: https://github.com/ianmiell/shutit/blob/master/library/taigaio/taigaio.py)

If you like dockerfiles, this should work: https://github.com/ianmiell/shutit/raw/master/library/taigaio/dockerfile/Dockerfile

👍
Would be great to have a docker image with every part of taiga :

  • taiga-back
  • taiga-front-dist
  • taiga-events

Do you mean a single image or three?
On Mar 15, 2015 7:29 AM, "Florian Bezagu" notifications@github.com wrote:

[image: 👍]
Would be great to have an docker image with every part of taiga :

  • taiga-back
  • taiga-front-dist
  • taiga-events


Reply to this email directly or view it on GitHub
#3 (comment).

Hi @ianmiell

Yes I mean a single image with the three parts inside it.

We already have an instance of taiga installed but we're moving our servers and I'd like to install taiga on my new Docker server.

I haven't looked at taiga for a while, but I could help you script an image
with this:

https://registry.hub.docker.com/u/imiell/taigaio/

Built from:

https://github.com/ianmiell/shutit/blob/master/library/taigaio/taigaio.py

But I'm not sure how much of this you know already, or how much taiga has
moved on.

On Sun, Mar 15, 2015 at 7:56 AM, Florian Bezagu notifications@github.com
wrote:

Hi @ianmiell https://github.com/ianmiell

Yes I mean a single image with the three parts inside it.

We already have an instance of taiga installed but we're moving our
servers and I'd like to install taiga on my new Docker server.


Reply to this email directly or view it on GitHub
#3 (comment).

@FlorianBezagu Check out https://github.com/benhutchins/docker-taiga which is Taiga's front and backend in one, and has support for taiga-events.