[web2py] Re: Controlling web2py development, qa and production staging environments

2016-10-12 Thread 黄祥
i think you can use version control software e.g. mercurial, subversion, 
git, etc and configuration management software like puppet, ansible, chef, 
salt, etc. set separate environment for that, and then make sure it match 
with web2py appconfig.
e.g.
*models/db.py*
from gluon.contrib.appconfig import AppConfig
config_path = os.path.join(request.folder, 'private')
myconf = AppConfig('%s/appconfig.ini' % config_path, reload = True)
myconf_env = myconf.get('environment.type')
db = DAL(myconf.get(myconf_env + '_' + 'db.uri'), 
 pool_size = myconf.get(myconf_env + '_' + 'db.pool_size'), 
 migrate_enabled = myconf.get(myconf_env + '_' + 'db.migrate_enabled'), 
 check_reserved = ['all'], 
 lazy_tables = True)

*development environment*
private/appconfig.ini
[environment]
*type = dev*

[dev_db]
uri  = sqlite://test.sqlite
pool_size= 10 ; ignored for sqlite
migrate_enabled  = true
migrate  = true
fake_migrate = false
fake_migrate_all = false

[prod_db]
uri  = postgres://postgres:password@localhost/test
pool_size= 10 ; ignored for sqlite
migrate_enabled  = false
migrate  = false
fake_migrate = false
fake_migrate_all = false

*production environment*
private/appconfig.ini
[environment]
*type = prod*

[dev_db]
uri  = sqlite://test.sqlite
pool_size= 10 ; ignored for sqlite
migrate_enabled  = true
migrate  = true
fake_migrate = false
fake_migrate_all = false

[prod_db]
uri  = postgres://postgres:password@localhost/test
pool_size= 10 ; ignored for sqlite
migrate_enabled  = false
migrate  = false
fake_migrate = false
fake_migrate_all = false

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Controlling web2py development, qa and production staging environments

2016-10-12 Thread Dave S


On Wednesday, October 12, 2016 at 3:08:42 PM UTC-7, Jim S wrote:
>
> 1.  I use git to install web2py on both my dev, staging and production 
> environments.
> 2.  Same as #1.
> 3.  Take a look at the AppConfig module.  You can store your database 
> connect string info there.  Your appconfig text file will be different on 
> your two environments.
>
 

> 4.  Not sure I'm understanding what you're getting at here.
>
> For me, I install web2py and pydal using git.
> I then create a mercurial repo (on bitbucket) of my application directory 
> under web2py/applications.  In my repo I have a default (development) and a 
> stable (production) branch.  On my dev machines I push to default and on my 
> production machines I pull from stable.  I use the bitbucket interface to 
> merge my default branch into stable whenever I want to update my production 
> environments.
>

Based on discussions in other contexts, avoid checking in to your rep the 
appconfig text file by that name.  Instead, make a copy of it as 
"appconfig-production" or "appconfig-dev_machine1" or some such, and check 
that in.   That way, you won't clobber the copy in use when you update, but 
you will be able to track it.

 

> Not saying this is best practice (far from it), but it works fine in our 
> 2-developer shop.
>
> Hope this helps.
>
> -Jim
>
>
/dps

 

> On Wednesday, October 12, 2016 at 3:23:35 AM UTC-5, Terrence Monroe wrote:
>
>> I asked basically the same question on StackOverflow
>>
>> http://stackoverflow.com/questions/39989174/controlling-web2py-development-qa-and-production-app-staging
>> but have some more insight into my requirements.
>>
>> I will be developing a website with a Postgres back-end. Locally, on
>> my laptop I will connect to Postgres with certain credentials and
>> remotely, only VPS I will connect to Postgres with different
>> credentials.
>>
>> Locally, I will run the rocket webserver for development then commit
>> my changes to git and push. Remotely, I will pull my changes via git
>> and run the Apache 2.2 webserver.
>>
>> In both environments, I require the pyDAL.
>>
>> My questions therefore are:
>> 1 - How should I obtain web2py, given the download options?
>> 2 - How should I obtain pyDAL once I have web2py
>> 3 - How do I configure things so that local and remote development
>> connect using the right Postgres credentials for the environment that
>> I am in, preferably automatically by detecting my environment.
>> 4 - How do I configure things so that locally I use the rocket
>> webserver and remotely I use Apache? I already know how to setup
>> Apache for web2py after reading the deployment chapter of the
>> book. And I have developed on the rocket webserver locally. It's just
>> a question of how do I switch between environments?
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Controlling web2py development, qa and production staging environments

2016-10-12 Thread Terrence Monroe
On Wed, Oct 12, 2016 at 7:14 PM, Dave S  wrote:

>
>
> On Wednesday, October 12, 2016 at 3:08:42 PM UTC-7, Jim S wrote:
>>
>> 1.  I use git to install web2py on both my dev, staging and production
>> environments.
>> 2.  Same as #1.
>>
>
> And 1) and 2) can be combined with the --recursive flag, innit?
>
>>
Yes, they can. I just did it and the README says so as well:
https://github.com/metaperl/web2py#important-reminder-about-this-git-repo

Thanks for all the help everyone.

---
You received this message because you are subscribed to a topic in the
Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/web2py/HAdqO6Kjpis/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




-- 
Terrence Brannon 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Controlling web2py development, qa and production staging environments

2016-10-12 Thread Dave S


On Wednesday, October 12, 2016 at 3:08:42 PM UTC-7, Jim S wrote:
>
> 1.  I use git to install web2py on both my dev, staging and production 
> environments.
> 2.  Same as #1.
>

And 1) and 2) can be combined with the --recursive flag, innit?

 

> 3.  Take a look at the AppConfig module.  You can store your database 
> connect string info there.  Your appconfig text file will be different on 
> your two environments.
> 4.  Not sure I'm understanding what you're getting at here.
>
> For me, I install web2py and pydal using git.
> I then create a mercurial repo (on bitbucket) of my application directory 
> under web2py/applications.  In my repo I have a default (development) and a 
> stable (production) branch.  On my dev machines I push to default and on my 
> production machines I pull from stable.  I use the bitbucket interface to 
> merge my default branch into stable whenever I want to update my production 
> environments.
>
> Not saying this is best practice (far from it), but it works fine in our 
> 2-developer shop.
>
> Hope this helps.
>
> -Jim
>
>
/dps
 

> On Wednesday, October 12, 2016 at 3:23:35 AM UTC-5, Terrence Monroe wrote:
>
>> I asked basically the same question on StackOverflow
>>
>> http://stackoverflow.com/questions/39989174/controlling-web2py-development-qa-and-production-app-staging
>> but have some more insight into my requirements.
>>
>> I will be developing a website with a Postgres back-end. Locally, on
>> my laptop I will connect to Postgres with certain credentials and
>> remotely, only VPS I will connect to Postgres with different
>> credentials.
>>
>> Locally, I will run the rocket webserver for development then commit
>> my changes to git and push. Remotely, I will pull my changes via git
>> and run the Apache 2.2 webserver.
>>
>> In both environments, I require the pyDAL.
>>
>> My questions therefore are:
>> 1 - How should I obtain web2py, given the download options?
>> 2 - How should I obtain pyDAL once I have web2py
>> 3 - How do I configure things so that local and remote development
>> connect using the right Postgres credentials for the environment that
>> I am in, preferably automatically by detecting my environment.
>> 4 - How do I configure things so that locally I use the rocket
>> webserver and remotely I use Apache? I already know how to setup
>> Apache for web2py after reading the deployment chapter of the
>> book. And I have developed on the rocket webserver locally. It's just
>> a question of how do I switch between environments?
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Controlling web2py development, qa and production staging environments

2016-10-12 Thread Jim S
1.  I use git to install web2py on both my dev, staging and production 
environments.
2.  Same as #1.
3.  Take a look at the AppConfig module.  You can store your database 
connect string info there.  Your appconfig text file will be different on 
your two environments.
4.  Not sure I'm understanding what you're getting at here.

For me, I install web2py and pydal using git.
I then create a mercurial repo (on bitbucket) of my application directory 
under web2py/applications.  In my repo I have a default (development) and a 
stable (production) branch.  On my dev machines I push to default and on my 
production machines I pull from stable.  I use the bitbucket interface to 
merge my default branch into stable whenever I want to update my production 
environments.

Not saying this is best practice (far from it), but it works fine in our 
2-developer shop.

Hope this helps.

-Jim

On Wednesday, October 12, 2016 at 3:23:35 AM UTC-5, Terrence Monroe wrote:

> I asked basically the same question on StackOverflow
>
> http://stackoverflow.com/questions/39989174/controlling-web2py-development-qa-and-production-app-staging
> but have some more insight into my requirements.
>
> I will be developing a website with a Postgres back-end. Locally, on
> my laptop I will connect to Postgres with certain credentials and
> remotely, only VPS I will connect to Postgres with different
> credentials.
>
> Locally, I will run the rocket webserver for development then commit
> my changes to git and push. Remotely, I will pull my changes via git
> and run the Apache 2.2 webserver.
>
> In both environments, I require the pyDAL.
>
> My questions therefore are:
> 1 - How should I obtain web2py, given the download options?
> 2 - How should I obtain pyDAL once I have web2py
> 3 - How do I configure things so that local and remote development
> connect using the right Postgres credentials for the environment that
> I am in, preferably automatically by detecting my environment.
> 4 - How do I configure things so that locally I use the rocket
> webserver and remotely I use Apache? I already know how to setup
> Apache for web2py after reading the deployment chapter of the
> book. And I have developed on the rocket webserver locally. It's just
> a question of how do I switch between environments?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.