How do you reset a Discourse installation

(Manthan Mallikarjun) #1


I want to reset my discourse installation (delete everything and rebuild it).

Whats the easiest way to do this?


(Kane York) #3
rm -rf /var/discourse/shared/standalone/postgres* /var/discourse/shared/standalone/redis*

(Jens Maier) #4

As Kane suggested, flush your Postgres and Redis data, except that you shouldn’t simply delete these files. Instead:

dropdb $dbname && createdb -O $user $dbname
redis-cli -n $rdbnum flushdb
cd /var/www/discourse && git clean -f -d -X

The first line requires superuser privileges with PostgreSQL. If you’re using a password for Redis, add -a $pass.

Note that dropping and recreating the database also destroys extensions. I do not know whether Discourse’s migrations can create these for you, so migrations may fail until you figure out which extensions you need (try hstore and pg_trgm).

(Kane York) #5

Not really… the Docker install calls createdb for you with the correct parameters (which those aren’t IIRC) as part of the build. And CREATE EXTENSION IF NOT EXISTS.

(Jens Maier) #6

postgres.template.yml calls createdb without any params, then creates the user, grants all privileges on the db and assigns ownership of the public schema to the user.

Is there a reason why non-privileged users should not own their database?

(Manthan Mallikarjun) #7

Sorry guys, this was too confusing for me. I ended up just trashing everything and then rebuilding it.

Thanks for your help anyways.