mirror of
https://github.com/modoboa/modoboa.git
synced 2026-04-26 01:16:01 +03:00
[GH-ISSUE #1255] Need to re-create modoboa's database #1020
Labels
No labels
bug
bug
dependencies
design
documentation
duplicate
enhancement
enhancement
enhancement
feedback-needed
help-needed
help-needed
installer
invalid
looking-for-sponsors
modoboa-contacts
new-ui
new-ui
pr
pull-request
pyconfr
python
question
security
stale
webmail
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-modoboa#1020
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sorcer1122 on GitHub (Sep 28, 2017).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1255
Hello,
I was trying to install afterlogic webmail frontend but it messed up my MariaDB and I ended up loosing modoboa's database before I made a backup. So, I would appreciate if anyone could help me to recreate the database again. I have created a user already, created a DB, granted this user rights over the DB and now I am getting the following in postfix log:
warning: mysql query failed: Table 'modoboa.admin_domain' doesn't exist
When I try to create this table, it asks me about columns and I have no idea how many columns I need.
Thanks in advance!
@tonioo commented on GitHub (Sep 29, 2017):
@sorcer1122 How did you install modoboa?
@sorcer1122 commented on GitHub (Sep 29, 2017):
@tonioo I installed it via the script run.py, so automated installation.
@tonioo commented on GitHub (Sep 29, 2017):
Ok, so the easiest way to recreate your database is to run the following commands:
If it doesn't, drop the modoboa database, recreate it, check permissions and try again.
@sorcer1122 commented on GitHub (Sep 29, 2017):
@tonioo Thanks!
python manage.py migrate gives me
Operations to perform:
Apply all migrations: admin, auth, authtoken, contenttypes, core, lib, limits, modoboa_amavis, modoboa_contacts, modoboa_postfix_autoreply, relaydomains, reversion, sessions, sites
Running migrations:
No migrations to apply.
python manage.py load_initial_data gives no output
python manage.py set_default_site mydomain.com gives no output
However, it did not help. So, I dropped DB, recreated it and gave permissions:
+------------------------------------------------------------------------+
| Grants for modoboa@% |
+------------------------------------------------------------------------+
| GRANT USAGE ON . TO 'modoboa'@'%' |
| GRANT ALL PRIVILEGES ON
modoboa.* TO 'modoboa'@'%' WITH GRANT OPTION |+------------------------------------------------------------------------+
Still and same output as above after migrate, load_initial_data and set_default_site and DB is still empty, here is what I see in MariaDB:
MariaDB [modoboa]> show tables;
Empty set (0.00 sec)
Any ideas?
@tonioo commented on GitHub (Sep 29, 2017):
Check the instance/settings.py file to see if you've configured the same database...
@sorcer1122 commented on GitHub (Sep 29, 2017):
@tonioo I checked settings.py and I can see that the DB is the same. I have also tried to re-create a user again and granted it all rights over the database, I have ended up with the following (I only need local connection):
+----------------------------------------------------------------------------------------------------------------+
| Grants for modoboa@localhost |
+----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON . TO 'modoboa'@'localhost' IDENTIFIED BY PASSWORD 'HASH_PASS' |
| GRANT ALL PRIVILEGES ON
modoboa. TO 'modoboa'@'localhost' |+----------------------------------------------------------------------------------------------------------------+
I am still getting:
MariaDB [modoboa]> show tables;
Empty set (0.00 sec)
I have also tried to log in with my modoboa username & password, open modoboa's DB and create a test table with 1 column, everything works fine but I cannot recreate the default DB structure with the commands you provided above.
@tonioo commented on GitHub (Sep 29, 2017):
@sorcer1122 and what happens if you run the migrate command once again ?
@sorcer1122 commented on GitHub (Sep 29, 2017):
@tonioo All the time same output:
Apply all migrations: admin, auth, authtoken, contenttypes, core, lib, limits, modoboa_amavis, modoboa_contacts, modoboa_postfix_autoreply, relaydomains, reversion, sessions, sites
Running migrations:
No migrations to apply.
@sorcer1122 commented on GitHub (Sep 29, 2017):
Not sure whether it is helpful but...
I am also not able to update any extensions. After I do pip install modoboa-.....==1.2.0, extensions is being downloaded but after I do python manage.py migrate, I get 'no migrations to apply'. After python manage.py collectstatic I get '0 static files copied to '/srv/modoboa/instance/sitestatic', 2204 unmodified' and the extension is still there, outdated.
Funnily enough, everything seems to work smoothly: I can add domains, aliases, email users. I am not confused dot com.
@tonioo commented on GitHub (Sep 29, 2017):
@sorcer1122 So you're saying everything works as expected now?
@sorcer1122 commented on GitHub (Sep 29, 2017):
@tonioo it looks like yes, everything is working. I do not see any errors in logs. However, the DB is still empty (weird, isn't it?)
Also, I am not able to update any extensions (as I explained above).
@tonioo commented on GitHub (Sep 29, 2017):
Have you reloaded uwsgi?
@sorcer1122 commented on GitHub (Sep 29, 2017):
Thanks, I can now see the updated extension!!! Completely forgot about uwsgi...Perhaps you should amend the manual - https://modoboa.readthedocs.io/en/latest/upgrade.html ...after phrase 'Finally, restart your web server' you can add something like 'and uwsgi'.
I am a little bit confused about the DB though. Not sure where modoboa keeps its data...do you think it will work smoothly without a single record in the DB?
@sorcer1122 commented on GitHub (Sep 29, 2017):
Not sure whether this is related but I am now unable to send mail via webmail. Gives me error 500 with the following in the console:
POST https://mydomain.com/webmail/?action=compose 500 ()
(anonymous) @ VM492:1
send @ jquery.min.js:5
ajax @ jquery.min.js:5
sendmail @ webmail.js:1044
i @ jquery.min.js:3
dispatch @ jquery.min.js:3
v.handle @ jquery.min.js:3
in /var/log/mail.log I can see:
connection established from...
lost connection after AUTH from...
disconnect...
If I do postmap -q user@mydomain.com mysql:/etc/postfix/sql-domains.cf I get the following output:
postmap: warning: mysql query failed: Table 'modoboa.admin_domain' doesn't exist
postmap: fatal: table mysql:/etc/postfix/sql-domains.cf: query error: Success
Clearly, there is a problem in the DB. Is there a list of all the tables necessary for modoboa DB?
:(
@tonioo commented on GitHub (Oct 2, 2017):
You should not have to deal with that. Are you using a mysql cluster or similar?
@sorcer1122 commented on GitHub (Oct 2, 2017):
I am using MariaDB. It was a default installation and I don't think clustering is enabled
@sorcer1122 commented on GitHub (Oct 4, 2017):
Still cannot send any emails via webmail, error 500 all the time and nothing specific in logs. Also, I am not able to create any user with error 400
P.S. Found this in the debug console while trying to send an email: "character mapping must return integer, None or unicode"
@sorcer1122 commented on GitHub (Oct 4, 2017):
Resolved, many thanks for the interest!