Skip to content

Commands and Fixes

Alfred Gutierrez edited this page Jan 10, 2021 · 9 revisions

Some common commands and fixes used throughout the app.

Activating Admin

Guildbit only has authentication for admin usage at the moment. You can register your account by visiting http://{YOUR_APP}/login to register via Steam's OpenID authentication. You will need to have a Steam API Key registered (see below).

Once registered, you can log into your database and set the user's account role to 1. 1 is an admin account. You should then be able to access the /admin route.

UPDATE user SET role = 1 WHERE id = 1;

You should then be able to access http://{YOUR APP}/admin.

You only need to do this for the first account registered. Any other accounts can be updated to an admin role within the admin control panel.

Inspecting Celery queues

celery inspect scheduled --app=app.tasks

http://celery.readthedocs.org/en/latest/userguide/monitoring.html#management-command-line-utilities-inspect-control

WEBrick long request fix

Sometimes when running ScoutRealtime behind a firewall, the requests might take ~5s each. This causes some delays in the realtime monitoring.

vim /home/alf/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/1.9.1/webrick/config.rb

Update :DoNotReverseLookup => nil, to :DoNotReverseLookup => true,

scout_realtime stop
scout_realtime start

http://stackoverflow.com/questions/1156759/webrick-is-very-slow-to-respond-how-to-speed-it-up

Setting SuperUser on a virtual server

sudo /usr/sbin/murmurd -ini /etc/mumble-server.ini -supw [password] [id]

This will create a SuperUser password for the virtual server ID. If none is given, 1 will be used.

This also sets the password without having to restart the server.

Database Migrations

Refer to http://blog.miguelgrinberg.com/post/flask-migrate-alembic-database-migration-wrapper-for-flask as a user guide for a general idea on migrations.

Also https://github.com/miguelgrinberg/Flask-Migrate as a resource.

Removing faulty murmur virtual servers

Occasionally there are some connectivity issues when users are creating servers which lead to some "dead" servers that are created, but not running. These must be removed via iPython with Ice until there's an admin tool to remove these programatically.

$ ssh [email protected]
$ cd /srv/murmur-rest
$ . env/bin/activate
$ ipython
import os
import settings
import Ice
Ice.loadSlice('', ['-I' + Ice.getSliceDir(), os.path.join(settings.MURMUR_ROOT, settings.SLICE_FILE)])
import Murmur
ice = Ice.initialize()
proxy = ice.stringToProxy(settings.ICE_HOST.encode('ascii'))
meta = Murmur.MetaPrx.checkedCast(proxy)

## Replace ID with mumble_instance id
server = meta.getServer({id})
server.stop()
server.delete()

and that should do it.

Updating Translations

To update translations, edit the po files for the respective language using a PO Editor, or any text editor.

Once updated, run the following command from the project root:

pybabel compile -f -d app/translations

This will compile the .po files into .mo, which are an optimized version of the translation to be used by the application. The activated languages in settings.py should work based on the browser's language settings. Or you can just set the cookie: language to fr.

Refer to this guide for further info on pybabel: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xiv-i18n-and-l10n

Steam API Key Registration

http://steamcommunity.com/dev/apikey

Disabling docker-proxy on Murmur Servers

This can reduce memory usage drastically since Docker will run a proxy for each port, unless this is disabled.

Create /etc/docker/daemon.json and add:

{
    "userland-proxy": false
}

Restart dockerd:

sudo systemctl restart docker