Skip to content

Instantly share code, notes, and snippets.

@shuairan
Last active July 28, 2021 12:58
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save shuairan/160015f071ef080e841d to your computer and use it in GitHub Desktop.
Save shuairan/160015f071ef080e841d to your computer and use it in GitHub Desktop.
Taiga.io Backend und Frontend auf Uberspace installieren

Orientiert sich an: http://taigaio.github.io/taiga-doc/dist/setup-production.html mit Anpassungen für Uberspace

Backend installation

PostgreSQL

siehe: Uberspace: Database PostgreSQL

uberspace-setup-postgresql

dann erst mal ausloggen und wieder einloggen.
Dann sind die Befehle verfügbar um Datenbankuser/Datenbank anzulegen:

createuser taiga
createdb taiga -O taiga

Python Environment

pip3.4 install virtualenvwrapper --user
source ~/bin/virtualenvwrapper_lazy.sh 
mkvirtualenv -p /usr/local/bin/python3.4 taiga
source ~/.virtualenvs/taiga/bin/activate

taiga-back

Download taiga-back

cd ~
git clone https://github.com/taigaio/taiga-back.git taiga-back
cd taiga-back
git checkout stable   #or stay at branch master for bleeding edge

Erstmal alle requirements für taiga-back installieren. Durch virtualenv wird das in $HOME/.virtualenvs/taiga abgelegt.

pip3.4 install -r requirements.txt

Ich musste dann noch $PYTHONPATH setzen, damit die mit pip installierten Packages in sys.path verfügbar sind:

export PYTHONPATH*$HOME/.virtualenvs/taiga/lib/python3.4/site-packages

weiter geht es mit der offizielen Installationsanleitung:

python manage.py migrate --noinput
python manage.py loaddata initial_user
python manage.py loaddata initial_project_templates
python manage.py loaddata initial_role
python manage.py collectstatic --noinput

und falls gewünscht:

python manage.py sample_data

jetzt noch konfigurieren, dabei die example.com URL abändern zu deiner eigenen URL:

from .common import *

MEDIA_URL = "http://example.com/media/"
STATIC_URL = "http://example.com/static/"
ADMIN_MEDIA_PREFIX = "http://example.com/static/admin/"
SITES["front"]["domain"] = "example.com"

SECRET_KEY = "theveryultratopsecretkey"

DEBUG = False
TEMPLATE_DEBUG = False
PUBLIC_REGISTER_ENABLED = True

DEFAULT_FROM_EMAIL = "no-reply@example.com"
SERVER_EMAIL = DEFAULT_FROM_EMAIL

# Uncomment and populate with proper connection parameters
# for enable email sending.
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_USE_TLS = True
EMAIL_HOST = "ASTEROID.uberspace.de"
EMAIL_HOST_USER = "USER@asteroid.uberspace.de"
EMAIL_HOST_PASSWORD = "PASSWORD"
EMAIL_PORT = 587

hier müssen natürlich ASTEROID und USER entsprechend eingetragen werden. Das PASSWORD ist das selbe wie für den SSH-Zugang (initial nicht gesetzt, im Dashboard einstellen!
Standardmäßig startet der Backend-Server auf Port 8000.
Wir sollten aber einen anderen Port als 8000 verwenden:

TAIGAPORT*$(( $RANDOM % 4535 + 61000)); netstat -tulpen | grep $TAIGAPORT && echo "versuch's nochmal"

und starten dann den Server mit:

python manage.py runserver $TAIGAPORT

Frontend installation

taiga-front generiert einen Batzen statischer Dateien, die dann später über einen Webserver ausgeliefert werden und über die URL zur API mit dem Backend kommunizieren.

Ruby

Gewünsche Ruby Version aktivieren wie in Uberspace: ruby beschrieben. Also zum Beispiel:

cat <<'__EOF__' >> ~/.bash_profile
export PATH=/package/host/localhost/ruby-2.1.1/bin:$PATH
export PATH=$HOME/.gem/ruby/2.1.0/bin:$PATH
__EOF__

Danach geht es weiter mit:

gem install --user-install sass scss-lint

Und jetzt noch npm vorbereiten: Uberspace: nodejs/npm

cat > ~/.npmrc <<__EOF__
prefix * $HOME
umask * 077
__EOF__

Gulp und Bower

Abweichend zur Taiga.io-Installationsanleitung ist hier das --prefix wichtig!

npm install -g --prefix*$HOME gulp bower

taiga-front

taiga-front installieren:

cd ~
git clone https://github.com/taigaio/taiga-front.git taiga-front
cd taiga-front
git checkout stable	 #or stay at branch master for bleeding edge

alle Abhängigkeiten installieren:

npm install
bower install

und in ~/taiga-front/conf/main.json die entsprechende URL eintragen:

{
    "api": "http://example.com/api/v1/",
    "eventsUrl": "ws://example.com/events",
    "debug": "true",
    "publicRegisterEnabled": true,
    "privacyPolicyUrl": null,
    "termsOfServiceUrl": null
}

example.com muss hier mit der verwendeten Domain ersetzt werden (deine Uberspace URL), ohne die Angabe von einem Port. Falls du keinen Apache-Proxy (siehe nächster Abschnitt) verwendest, kann hier auch der Port eingetragen werden (http://example.com:$TAIGAPORT/api/v1), muss dann aber weitergeleitet werden.

Mit gulp kann jetzt alles fürs Frontent erzeugt werden.

cd ~/taiga-front
gulp deploy

Mit dem Befehl "gulp" kann ein Testserver auf Port 9001 gestartet werden, dafür benötigt man aber auch Port Forwarding und ist eher für Development-Umgebung und hier nicht empfohlen.

Apache konfigurieren

Hier gibt es bestimmt elegantere Lösungen, aber manchmal will man schnell Ergebnisse sehen und nicht erst noch einen schönen Deploy-Workflow ausarbeiten ;)

Dateien kopieren

Dist Files fürs Frontend in den Apache Ordner verschieben. Falls eine andere Domain als die Uberspace-URL verwendet werden soll muss der Pfad entsprechend angepasst werden.

cp -r ~/taiga-front/dist/* $HOME/html/

Static Files fürs Backend:

cp -r ~/taiga-back/static $HOME/html/
#cp -r ~/taiga-back/media $HOME/html/

Der "media" Ordner wird in der offiziellen Anleitung beschrieben, war bei mir aber nicht vorhanden.

.htaccess

Die offizielle Anleitung verwendent nginx als Webserver, wir konfigurieren hier aber den schon vorhandenen Apache.
Natürlich geht es auch ohne den Proxy zum Backend, dann musst du das Kontrollzentrum wie in Uberspace: System/Ports beschrieben deinen gewählten Port weiterleiten lassen.

$HOME/html/.htaccess

RewriteEngine On

# api requests
RewriteCond %{REQUEST_URI} ^/api
RewriteRule ^(.*)$ http://127.0.0.1:$TAIGAPORT/$1 [P]
RequestHeader set X-Forwarded-Proto https env*HTTPS

# deliver files, if not a file deliver index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/static/
RewriteCond %{REQUEST_URI} !^/media/
RewriteRule ^ index.html [L]

Dadurch liefert Apache jetzt alle vorhandenen Dateien aus (JS, CSS, IMG, etc), /api Request werden an das Taiga-Backend weitergeleitet und für alles andere gibt es die index.html zurück. Das ist wichtig damit später Direktaufrufe wie auf http://example.com/project/test/issues richtig verarbeitet werden.

Jetzt sollte alles eingerichtet sein und funktionieren! Browser öffnen und http://USER.ASTEROID.uberspace.de aufrufen und anmelden. Vorausgesetzt du hast die python manage.py Befehle ausgeführt kannst du dich mit User admin und Passwort 123123 einloggen (Passwort ändern!)

daemon

Mit Hilfe der Uberspace: Daemontools konfigurieren wir einen Service für unser Backend. Aktiviere services: (das sollte nicht benötigt werden da während der Installation von PostgreSQL schon die Services aktiviert wurden)

test -d ~/service || uberspace-setup-svscan 

Service einrichten

uberspace-setup-service taiga gunicorn -w 3 -t 60 --chdir /home/$USER/taiga-back --error-logfile - --pythonpath=. -b 0.0.0.0:$TAIGAPORT taiga.wsgi

und starten:

svc -u ~/service/taiga
@jlntrt
Copy link

jlntrt commented Oct 5, 2015

Hallo. Weißt du, wie ich folgenden Fehler beheben kann? Dankeschön!

(taiga)[user@centaurus ~]$ mkvirtualenv -p /usr/local/bin/python3.4 taiga
Running virtualenv with interpreter /usr/local/bin/python3.4
Using base prefix '/package/host/localhost/python-3.4'
New python executable in taiga/bin/python3.4
Not overwriting existing python script taiga/bin/python (you must use taiga/bin/python3.4)
Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
File "/home/user/lib/python2.6/virtualenvwrapper/hook_loader.py", line 223, in
main()
File "/home/user/lib/python2.6/virtualenvwrapper/hook_loader.py", line 101, in main
console = logging.StreamHandler(stream=sys.stderr)
TypeError: init() got an unexpected keyword argument 'stream'

@rufiusluck
Copy link

Moin moin,

irgendwie hänge ich bei folgendem Schritt:

export PYTHONPATH_$HOME/.virtualenvs/taiga/lib/python3.4/site-packages
-bash: export: `PYTHONPATH_/home/XXXXX/.virtualenvs/taiga/lib/python3.4/site-packages': not a valid identifier

Gruß Rufius

@68040
Copy link

68040 commented Mar 15, 2017

Bei mir scheitert es ab pip3.4 install -r requirements.txt am Paket cairocffi.

Collecting cairocffi (from CairoSVG==2.0.1->-r requirements.txt (line 39))
  Using cached cairocffi-0.8.0.tar.gz
    Complete output from command python setup.py egg_info:
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
    compilation terminated.
    Traceback (most recent call last):
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/unixccompiler.py", line 116, in _compile
        extra_postargs)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/ccompiler.py", line 909, in spawn
        spawn(cmd, dry_run=self.dry_run)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/spawn.py", line 36, in spawn
        _spawn_posix(cmd, search_path, dry_run=dry_run)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/spawn.py", line 162, in _spawn_posix
        % (cmd, exit_status))
    distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/bdist_egg.py", line 161, in run
        cmd = self.call_command('install_lib', warn_dir=0)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/bdist_egg.py", line 147, in call_command
        self.run_command(cmdname)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/install_lib.py", line 11, in run
        self.build()
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/command/install_lib.py", line 107, in build
        self.run_command('build_ext')
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/build_ext.py", line 75, in run
        _build_ext.run(self)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/command/build_ext.py", line 448, in build_extensions
        self.build_extension(ext)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
        _build_ext.build_extension(self, ext)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/command/build_ext.py", line 503, in build_extension
        depends=ext.depends)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/ccompiler.py", line 574, in compile
        self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/unixccompiler.py", line 118, in _compile
        raise CompileError(msg)
    distutils.errors.CompileError: command 'gcc' failed with exit status 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 157, in save_modules
        yield saved
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 255, in run_setup
        DirectorySandbox(setup_dir).run(runner)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 285, in run
        return func()
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 253, in runner
        _execfile(setup_script, ns)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 47, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-h426ox9a/cffi-1.9.1/setup.py", line 202, in <module>
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: command 'gcc' failed with exit status 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1106, in run_setup
        run_setup(setup_script, args)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 258, in run_setup
        raise
      File "/package/host/localhost/python-3.4/lib/python3.4/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/package/host/localhost/python-3.4/lib/python3.4/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 169, in save_modules
        saved_exc.resume()
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 144, in resume
        six.reraise(type, exc, self._tb)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 157, in save_modules
        yield saved
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 255, in run_setup
        DirectorySandbox(setup_dir).run(runner)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 285, in run
        return func()
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 253, in runner
        _execfile(setup_script, ns)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/sandbox.py", line 47, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-h426ox9a/cffi-1.9.1/setup.py", line 202, in <module>
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: command 'gcc' failed with exit status 1
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ylsm1m5x/cairocffi/setup.py", line 44, in <module>
        extras_require={'xcb': ['xcffib>=0.3.2']},
      File "/package/host/localhost/python-3.4/lib/python3.4/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/dist.py", line 317, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/dist.py", line 372, in fetch_build_eggs
        replace_conflicting=True,
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/pkg_resources/__init__.py", line 851, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1123, in best_match
        return self.obtain(req, installer)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1135, in obtain
        return installer(requirement)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/dist.py", line 440, in fetch_build_egg
        return cmd.easy_install(req)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 674, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 700, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 881, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1120, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/home/macounsv/.virtualenvs/taiga/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1108, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ylsm1m5x/cairocffi/

Wobei die libffi aber installiert zu sein scheint

$ whereis libffi
libffi: /usr/lib64/libffi.so

$ rpm -q libffi
libffi-3.0.5-3.2.el6.x86_64

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