User Controls

Problem setting up ISS

  1. #1
    Cootehill African Astronaut [my unsymmetrically blurry oregano]
    coote@Desktop ~/iss/ISS $ ./manage.py migrate
    /home/coote/.local/lib/python2.7/site-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
    warnings.warn(warning, RequestsDependencyWarning)
    Traceback (most recent call last):
    File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
    File "/home/coote/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
    File "/home/coote/.local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/coote/.local/lib/python2.7/site-packages/django/core/management/base.py", line 305, in run_from_argv
    self.execute(*args, **cmd_options)
    File "/home/coote/.local/lib/python2.7/site-packages/django/core/management/base.py", line 356, in execute
    output = self.handle(*args, **options)
    File "/home/coote/.local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 83, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__
    self.build_graph()
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 203, in build_graph
    self.applied_migrations = recorder.applied_migrations()
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
    self.ensure_schema()
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 231, in cursor
    cursor = self.make_debug_cursor(self._cursor())
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 204, in _cursor
    self.ensure_connection()
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
    self.connect()
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
    self.connect()
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 171, in connect
    self.connection = self.get_new_connection(conn_params)
    File "/home/coote/.local/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
    File "/home/coote/.local/lib/python2.7/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
    django.db.utils.OperationalError: FATAL: database "travisdb" does not exist


    Is travisdb needed for TravisCI or something? Should I be using Python 2.7 at all?
  2. #2
    Lanny Bird of Courage
    No need for travis in local, that's just the DB config for when travis is testing it.

    You'll want to change the `DATABASES` variable to point to a usable database. Probably the easiest way to do it is to install postgres on your development machine and point to that. The settings.py file in my setup looks like this:


    DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'iss',
    'USER': 'iss',
    'PASSWORD': 'passowrd_redacted',
    'HOST': 'localhost',
    'PORT': '',
    }
    }


    Yours should look the same except NAME (database name) USER (user/role) and PASSWORD (login password for the user) values would be whatever you setup for your database.

    Python 2.7 is correct, I'll have to upgrade to 3 one of these days but for now it requires the 2.x line.
  3. #3
    Cootehill African Astronaut [my unsymmetrically blurry oregano]
    OK, I was using psql wrong, and forgetting to put in a semicolon at the end.

    I have ISS running now, but it doesn't look quite right - some CSS is missing. Gulp generate crashes.

    coote@Desktop ~/iss/ISS/ISS/static-src $ gulp generate
    /home/coote/.local/lib/python2.7/site-packages/requests/__init__.py:83: Requ
    warnings.warn(warning, RequestsDependencyWarning)
    [09:47:30] Using gulpfile ~/iss/ISS/ISS/static-src/gulpfile.js
    [09:47:30] Starting 'icons'...
    [09:47:30] Starting 'smilies'...
    [09:47:30] Starting 'generate-extensions'...
    npm WARN iss-taboo-frontend@1.0.0 No description
    [09:47:40] Finished 'generate-extensions' after 9.46 s
    [09:47:40] Starting 'javascript'...
    sprintf() will be removed in the next major release, use the sprintf-js package
    [09:47:40] Finished 'icons' after 9.83 s
    [09:47:40] Starting 'less'...

    events.js:141
    throw er; // Unhandled 'error' event
    ^
    TypeError: this is not a typed array.
    at Function.from (native)
    at /home/coote/iss/ISS/ISS/static-src/node_modules/gulp-autoprefixer/ind
    at process._tickCallback (node.js:368:9)
  4. #4
    Lanny Bird of Courage
    Originally posted by Cootehill OK, I was using psql wrong, and forgetting to put in a semicolon at the end.

    I have ISS running now, but it doesn't look quite right - some CSS is missing. Gulp generate crashes.

    coote@Desktop ~/iss/ISS/ISS/static-src $ gulp generate
    /home/coote/.local/lib/python2.7/site-packages/requests/__init__.py:83: Requ
    warnings.warn(warning, RequestsDependencyWarning)
    [09:47:30] Using gulpfile ~/iss/ISS/ISS/static-src/gulpfile.js
    [09:47:30] Starting 'icons'...
    [09:47:30] Starting 'smilies'...
    [09:47:30] Starting 'generate-extensions'...
    npm WARN iss-taboo-frontend@1.0.0 No description
    [09:47:40] Finished 'generate-extensions' after 9.46 s
    [09:47:40] Starting 'javascript'...
    sprintf() will be removed in the next major release, use the sprintf-js package
    [09:47:40] Finished 'icons' after 9.83 s
    [09:47:40] Starting 'less'...

    events.js:141
    throw er; // Unhandled 'error' event
    ^
    TypeError: this is not a typed array.
    at Function.from (native)
    at /home/coote/iss/ISS/ISS/static-src/node_modules/gulp-autoprefixer/ind
    at process._tickCallback (node.js:368:9)

    Sweet, almost there. I'm like 90% sure this is a node version issue. Are you able to upgrade? If you need to keep your current version you can use nvm to maintain multiple versions on the same machine. I'm using the v10.x line and that's working, although I think you can use 8.x or 6.x as well.
  5. #5
    Cootehill African Astronaut [my unsymmetrically blurry oregano]
    Originally posted by Lanny Sweet, almost there. I'm like 90% sure this is a node version issue. Are you able to upgrade? If you need to keep your current version you can use nvm to maintain multiple versions on the same machine. I'm using the v10.x line and that's working, although I think you can use 8.x or 6.x as well.

    Yes, the problem was I was using a 4.x version of node, lol.

    It's running now.
  6. #6
    Hay Lanner, how do you implement CI/CD with ISS? Automated deployment still confuses me.
  7. #7
    Lanny Bird of Courage
    Originally posted by MORALLY SUPERIOR BEING 2.0 - The GMO Reckoning Hay Lanner, how do you implement CI/CD with ISS? Automated deployment still confuses me.

    Continuous delivery means a number of different things based on who you ask, I wouldn't really call the deployment process I have CD but I suppose some people would. There's two basic parts to it, the automated test runner and the deploy process.

    For testing there's a travis hook registered with github so whenever I push new code to the repo on GH travis will pull it, build it, and run the tests. It sends me an email if anything failed.

    Deployment is just an SSH script (well a "fabric" script which is just a ssh library for python that has some nice sugar if you're managing multiple hosts) that logs into the server, pulls the latest code, builds it and bounces the app server. This is all there is to it:


    from fabric.api import run, cd, prefix, env

    env.hosts = ['www@ws.niggasin.space']

    def deploy():
    with prefix('workon iss'):
    with cd('/opt/apps/ISS'):
    run('git pull')
    run('pip install -r requirements.txt')

    with cd('/opt/apps/ISS/ISS/static-src/'):
    run('npm install')
    run('npm install gulp-cli')
    run('node_modules/gulp-cli/bin/gulp.js generate --optimize')

    with cd('/opt/apps/ISS/'):
    run('sudo /bin/systemctl stop NiS-uwsgi.service')
    run('./manage.py migrate')
    run('./manage.py collectstatic --noinput')
    run('sudo /bin/systemctl start NiS-uwsgi.service')


    I just run it when I'm ready to push changes. If I'm smart I'll wait for travis to finish running the tests before pushing anything but sometimes I get impatient and just say fuck it, that's usually when the site breaks.

    Is there anything about automated deployment or CI/CD that confuses you specifically?
  8. #8
    Odigo Messenger - Now With Free 911 Service Houston [back fudge my lingam]
    Do you actually run redis or something for session management, or do you just use Postgres? I don't know where to look to find out.
  9. #9
    Lanny Bird of Courage
    Using postgres at the moment although I really should be keeping them in redis. It's just a configuration change.
  10. #10
    Odigo Messenger - Now With Free 911 Service Houston [back fudge my lingam]
    Sorry for all the clueless questions, but on my local deployment of ISS the JS files are all individual, but on this deployment it is nicely minified and compiled into one file. How is that done?
  11. #11
    Lanny Bird of Courage
    No problem, ask away. The setup can be a bit daunting, and it's only minimally documented so that's not really a clueless question.

    So when you run the `gulp generate` command to produce the frontend resources which live in `ISS/static` from the sources in `ISS/static-src` you can pass it the `--optimize` flag and that will spit out minified and combined JS and CSS and associated sourcemaps instead of the split async-loaded ones.

    I do recommend doing development with that turned off since it increases the recompile time significantly, but you definitely want the minified files for deployment.
    The following users say it would be alright if the author of this post didn't die in a fire!
  12. #12
    cupocheer Space Nigga [unwillingly condescend the dp]
    Originally posted by Lanny No problem, ask away. The setup can be a bit daunting, and it's only minimally documented so that's not really a clueless question.

    So when you run the `gulp generate` command to produce the frontend resources which live in `ISS/static` from the sources in `ISS/static-src` you can pass it the `–optimize` flag and that will spit out minified and combined JS and CSS and associated sourcemaps instead of the split async-loaded ones.

    I do recommend doing development with that turned off since it increases the recompile time significantly, but you definitely want the minified files for deployment.

    Are you completely sure that you are correct in paragraph 2? Isn't there something missing?
  13. #13
    Lanny Bird of Courage
    Originally posted by cupocheer Are you completely sure that you are correct in paragraph 2? Isn't there something missing?

    Leave this thread if you don't have anything productive to post

  14. #14
    Flatulant_bomb Tuskegee Airman
    Originally posted by Lanny Leave this thread if you don't have anything productive to post


    lol
  15. #15
    cupocheer Space Nigga [unwillingly condescend the dp]
    OP, you do realize that Lanny is attempting to hijack your thread, don't you?
  16. #16
    Odigo Messenger - Now With Free 911 Service Houston [back fudge my lingam]
    Originally posted by cupocheer OP, you do realize that Lanny is attempting to hijack your thread, don't you?

    ISS is the software this forum uses, and Lanny created it. OP was asking Lanny a question about it.
  17. #17
    cupocheer Space Nigga [unwillingly condescend the dp]
    Oh, I see. Kind of like don't believe what you know but what you're told to believe you know. Got'cha!
  18. #18
    Odigo Messenger - Now With Free 911 Service Houston [back fudge my lingam]
    Originally posted by cupocheer Oh, I see. Kind of like don't believe what you know but what you're told to believe you know. Got'cha!

    I never deployed a complex python app before, Lanny has, here it is.

    I am starting from a very low information place, and I tend to believe Lanny as his instructions always work.
  19. #19
    Odigo Messenger - Now With Free 911 Service Houston [back fudge my lingam]
    I can't figure out how to do a PR. Maybe it's cos I have a clone of the repo, but I need a fork? I dunno.

    Anyway suggest the following change to stop multiple quote requests being submitted:

    ISS\ISS\static-src\src\thread\thread.js
    Line 10: if(!e.detail || e.detail == 1){ //Only allows the first click
    Line 22: }}); //close brackets
  20. #20
    cupocheer Space Nigga [unwillingly condescend the dp]
    Originally posted by Odigo Messenger - Now With Free 911 Service I can't figure out how to do a PR. Maybe it's cos I have a clone of the repo, but I need a fork? I dunno.

    Anyway suggest the following change to stop multiple quote requests being submitted:

    ISS\ISS\static-src\src\thread\thread.js
    Line 10: if(!e.detail || e.detail == 1){ //Only allows the first click
    Line 22: }}); //close brackets

    Sometimes the 2nd release is not intentional -- just floating near the input function releases a duplicate post. Go figure.
Jump to Top