0

I've got a Jenkins/Nginx server running. But I get the error from Django:

 attempt to write a readonly database

So I solved this problem by changing the ownership of the project folder to the default user:

chown -R joren . 

Now Django is working properly, but Jenkins doesn't seem to agree because now it is unable to build due to permission errors.

How do I get both sides to work together properly?

Edit:

Nginx is runnings as www-data

Jenkins is running as jenkins

Edit2:

The job builds the directory from a git repository, activates the virtualenv, tests the django apps (and other django-specific operations) and then restarts the server. The src subdirectory of the directory to which it is built, is the root of the nginx server.

The workaround:

Switch sqlite3 for postgresql3. Still looking for a proper solution though.

  • What kind of database are you using? – Christopher Perrin Aug 08 '14 at 13:58
  • @ChristopherPerrin sqlite, like the tag says. –  Aug 08 '14 at 14:20
  • I didn't see the tag. Do Jenkins and Django need to use the same database? – Christopher Perrin Aug 08 '14 at 14:43
  • @ChristopherPerrin Jenkins gets the database from the repository and writes it to the django directory. –  Aug 08 '14 at 14:47
  • You need to consider this: http://www.sqlite.org/faq.html#q5 – Herson Aug 08 '14 at 18:34
  • @Herson I don't think that is the issue, since jenkins writes the database only once every build and leaves it alone after that. Django uses it after that, so only one user at a time writes. –  Aug 08 '14 at 20:33
  • 1
    can you describe what the job is doing in more details? A standard job should fetch and do things with the application entirely with jenkins user, if you are keeping your application elsewhere managed by you and not by jenkins, you are doing it wrong. – Giovanni Toraldo Aug 11 '14 at 08:29

1 Answers1

-2

Make a group for jekins and django, then give the group write permissions.

  • 4
    As kneejerk reactions go for dealing with permission issues, this'll work beautifully when the issue is reading or executing simultaneously. But if two processes are both trying to write to the same file, the permissions are actually preventing corruption and race conditions. I didn't downvote you, but I don't think your solution would solve the OP's issue. – Parthian Shot Aug 05 '14 at 20:25