User Controls
Problem setting up ISS
-
2018-08-26 at 11:46 PM UTC
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? -
2018-08-27 at 12:21 AM UTCNo 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. -
2018-08-27 at 2:27 PM UTCOK, 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) -
2018-08-27 at 3:01 PM UTC
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. -
2018-08-27 at 4:15 PM UTC
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. -
2018-09-08 at 11:07 PM UTCHay Lanner, how do you implement CI/CD with ISS? Automated deployment still confuses me.
-
2018-09-09 at 12:05 AM UTC
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?
-
2018-11-11 at 3:21 PM UTCDo 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.
-
2018-11-11 at 8:17 PM UTCUsing postgres at the moment although I really should be keeping them in redis. It's just a configuration change.
-
2018-11-19 at 12:35 AM UTCSorry 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?
-
2018-11-19 at 8:52 AM UTCNo 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. -
2018-11-19 at 10:38 PM UTC
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? -
2018-11-20 at 3:01 AM UTC
-
2018-11-20 at 3:06 AM UTC
-
2018-11-20 at 11:19 PM UTCOP, you do realize that Lanny is attempting to hijack your thread, don't you?
-
2018-11-20 at 11:27 PM UTC
-
2018-11-20 at 11:30 PM UTCOh, I see. Kind of like don't believe what you know but what you're told to believe you know. Got'cha!
-
2018-11-20 at 11:37 PM UTC
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. -
2018-11-25 at 2:16 AM UTCI 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 -
2018-11-25 at 2:23 AM UTC
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.