Ken
I was travelling so couldn't reply to this earlier. I am not using RDS.
everything on Amazon free stuff;
So i tried -
pg_dump -Fc dbname > dump.filename - On the development server
sudo -u root sudo -u postgres pg_restore -c -d dbname
/location/dump.filename - On the production
However after this when i run "fab deploy" again on development server it
breaks when it tries to run "python manage syncdb" remotely on prod.
server. It complains about ghost migrations (something in database which is
not on filesystem)
"/local/lib/python2.7/site-packages/south/migration/__init__.py", line 95,
in check_migration_histories
raise exceptions.GhostMigrations(ghosts)
south.exceptions.GhostMigrations:
! These migrations are in the database but not on disk:
<shop: 0026_initial>
<conf: 0005_initial>
<core: 0007_initial>
<generic: 0015_initial>
<blog: 0021_initial>
<forms: 0006_initial>
<pages: 0015_initial>
<galleries: 0002_initial>
<twitter: 0003_initial>
! I'm not trusting myself; either fix this yourself by fiddling
! with the south_migrationhistory table, or pass --delete-ghost-migrations
! to South to have it delete ALL of these records (this may not be good).
"
So to make my things work I commented out the
- python syncdb and makemigrate commands in the fabfile
- do manual local development database backup/dump
- copy the dump to production server
- restore the database using pg_restore command as stated above on prod.
server
- "fab deploy" on development machine to make any other changes available
to prod. server
SECOND ISSUE - i was not seeing any static media (photos, css) even after
running collectstatic on 'production' server. I was thinking that after
running 'collectstatic' on the Production machine, it would make my static
media available. however there were no product images in
/project/static/media/product folder
- so i deleted the /static entry in gitignore file on development machine
- ran collectstatic on development machine
- git add, commit
- fab deploy
It is working for me right now, but I am not sure, if it is the right
approach to get my static media displayed as well as syncing database?
Any inputs on my setup. My situation right now:
- started learning web development 3 months back
- I am single man army and trying to setup a website for a startup business
using free tools (aws, django, mezzanine, cartridge). Looking into
wordpress, woocommerce also
- laptop development & production server
- no Staging environment
On Thursday, December 11, 2014 9:29:09 PM UTC+5:30, Kenneth Bolton wrote:
>
> Hi Vikram,
>
> The danger of having `fab deploy` move your data from local to production
> is that an accidental `fab deploy` would overwrite your production
> database. This is fine when you are just getting started, but would be a
> problem going forward with each change to your code. I would caution
> against extending the `deploy` command to push your database. Instead,
> create Fabric functions that `local_backup` and `remote_restore`. Those
> would be run independently of the `deploy` command.
>
> To get a handle on the appropriate PostgreSQL commands, look at the
> fabfile:
> https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/project_template/fabfile.py#L290-L303
>
> Are you using RDS? Are you using a VPC? If you don't know, you most likely
> aren't, so don't sweat it.
>
> Keep learning and growing!
>
> best,
> ken
>
> On Thu, Dec 11, 2014 at 12:24 AM, vikraw <[email protected] <javascript:>>
> wrote:
>
>> Thanks Kenneth for your reply. You understood the issue correctly. Yes, I
>> am running Postgre locally. So if i understand correctly, here are my
>> options
>> 1- extend fabfile + add some keys to the settings.FABRIC
>> 2- manually do a local backup and then run a restore on target deployment
>>
>> Option 2 looks easier to me at this moment. last night i tried running
>> pg_restore on aws and was getting some "peer authentication" error which
>> seems like some .conf/user accounts issue.
>>
>> However in future i would like to just run '*fab deploy*'. I am new to
>> all these technologies and would appreciate if you could elaborate little
>> more on *option 1* .
>>
>> thanks
>> vikram
>>
>> On Thursday, December 11, 2014 12:09:21 AM UTC+5:30, Kenneth Bolton wrote:
>>>
>>> Hi Vikram,
>>>
>>> To restate your problem, you built a local cartridge instance and ran
>>> django's runserver against a local database. After deploying to AWS using
>>> `fab all` and an appropriately configured settings.FABRIC dictionary, you
>>> see none of the pages you added in your local instance.
>>>
>>> The fabfile that ships with Mezzanine does not move databases between
>>> deployment targets. If you are using PostgreSQL locally, the fabfile can be
>>> extended to do the dump for you. You will need to add some additional keys
>>> to settings.FABRIC for the local database that is to be backed up.
>>>
>>> hth,
>>> ken
>>>
>>> https://groups.google.com/forum/#!topic/mezzanine-users/X_Xs-Ei0OVw
>>>
>>>
>>>
>>> On Wed, Dec 10, 2014 at 11:52 AM, vikraw <[email protected]> wrote:
>>>
>>>> Hi
>>>>
>>>> I have been working on Mezzanine-Cartridge development for a few weeks
>>>> on my local development machine.
>>>>
>>>> Now I deployed to a Ubuntu AMI on Amazon webservices using the default
>>>> - Fabric.py script and 'fab all' command.
>>>>
>>>> However the following links are missing on the deployed site.
>>>> - About
>>>> - Blog
>>>> - Category
>>>> - Contact
>>>> - Shop Products
>>>>
>>>> *Also I cannot see any additional products or added pages on deployed
>>>> website.
>>>>
>>>> Attached is a pic of my the default DEPLOYED site
>>>>
>>>>
>>>> <https://lh6.googleusercontent.com/-Un7OEojIQDs/VIh6GblMhdI/AAAAAAAACQg/hwWbPwLrtcE/s1600/Capture1.PNG>
>>>>
>>>>
>>>> Attached is a pic of my the default DEVELOPMENT LOCAL site
>>>>
>>>>
>>>> <https://lh6.googleusercontent.com/-Lviy9LJVjms/VIh3zfB8ddI/AAAAAAAACQU/0hTybKIyNnE/s1600/Capture.PNG>
>>>>
>>>>
>>>>
>>>>
>>>> HOWEVER, I can see the above mentioned links in the development
>>>> environment which is also on Ubuntu.
>>>>
>>>>
>>>> Development environment is as follows - pip freeze o/p - using
>>>> virtualenv
>>>> Cartridge==0.9.5
>>>> Django==1.6.8
>>>> Fabric==1.10.0
>>>> Mezzanine==3.1.10
>>>> Pillow==2.6.1
>>>> South==1.0.1
>>>> argparse==1.2.1
>>>> beautifulsoup4==4.1.3
>>>> bleach==1.4
>>>> boto==2.34.0
>>>> django-appconf==0.6
>>>> django-compressor==1.4
>>>> django-ses==0.7.0
>>>> ecdsa==0.11
>>>> filebrowser-safe==0.3.6
>>>> future==0.9.0
>>>> grappelli-safe==0.3.13
>>>> html5lib==0.999
>>>> mezzanine-bsbanners==0.1.4
>>>> oauthlib==0.7.2
>>>> paramiko==1.15.1
>>>> psycopg2==2.5.4
>>>> pycrypto==2.6.1
>>>> pytz==2014.10
>>>> reportlab==3.1.8
>>>> requests==2.4.3
>>>> requests-oauthlib==0.4.2
>>>> six==1.8.0
>>>> tzlocal==1.0
>>>> wsgiref==0.1.2
>>>> xhtml2pdf==0.0.6
>>>>
>>>>
>>>> I was expecting that one's development is finalized and uploaded to the
>>>> repository, FABRIC will automatically create a similar snapshot in
>>>> production server.
>>>>
>>>> What should I do to get all my products and additional pages to come up
>>>> on deployed site?? I read somewhere that fabric doesn't syncs the database
>>>> even though it syncs the schema. So i am guessing if that is the issue?
>>>> My excitement of development on Mezzanine-Cartridge is fading as
>>>> deployment is very tedious.
>>>>
>>>> I follow the following process
>>>> - virtualenv
>>>> - debug=true
>>>> - collectstatic
>>>> - git add *, git commit ,
>>>> - fab all
>>>>
>>>> I would appreciate the help
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Mezzanine Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.