2016-08-17 15:17:47 +02:00
|
|
|
# Blender Cloud
|
|
|
|
|
2017-03-07 13:56:01 +01:00
|
|
|
Welcome to the [Blender Cloud](https://cloud.blender.org/) code repo!
|
|
|
|
Blender Cloud runs on the [Pillar](https://pillarframework.org/) framework.
|
2016-08-17 15:17:47 +02:00
|
|
|
|
2018-06-22 16:09:29 +02:00
|
|
|
## Development setup
|
|
|
|
Jumpstart Blender Cloud development with this simple guide.
|
2016-08-17 15:17:47 +02:00
|
|
|
|
2018-06-22 16:09:29 +02:00
|
|
|
### System setup
|
|
|
|
Blender Cloud relies on a number of services in order to run. Check out the [Pillar system setup](
|
2018-06-22 16:13:56 +02:00
|
|
|
https://pillarframework.org/development/system_setup/#step-by-step-setup) to set this up.
|
2016-09-30 12:08:55 +02:00
|
|
|
|
2018-06-22 16:09:29 +02:00
|
|
|
### Check out the code
|
|
|
|
Go to the local development directory and check out the following repositories, next to each other.
|
2016-09-30 12:08:55 +02:00
|
|
|
|
2018-06-22 16:09:29 +02:00
|
|
|
```
|
|
|
|
cd /home/guest/Developer
|
2016-09-30 12:08:55 +02:00
|
|
|
git clone git://git.blender.org/pillar-python-sdk.git
|
2018-06-22 16:09:29 +02:00
|
|
|
git clone git://git.blender.org/pillar.git
|
|
|
|
git clone git://git.blender.org/attract.git
|
|
|
|
git clone git://git.blender.org/flamenco.git
|
|
|
|
git clone git://git.blender.org/pillar-svnman.git
|
|
|
|
git clone git://git.blender.org/blender-cloud.git
|
|
|
|
```
|
|
|
|
|
|
|
|
### Initial setup and configuration
|
|
|
|
|
2018-06-22 16:23:44 +02:00
|
|
|
Create a virtualenv for the project and install the requirements:
|
2018-06-22 16:09:29 +02:00
|
|
|
|
|
|
|
```
|
2018-06-22 16:23:44 +02:00
|
|
|
cd blender-cloud
|
|
|
|
mkvirtualenv blender-cloud -p python3.6
|
2018-06-22 16:09:29 +02:00
|
|
|
pip install -r requirements-dev.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
Build assets and templates for all Blender Cloud dependencies using Gulp.
|
|
|
|
|
|
|
|
```
|
|
|
|
./gulp all
|
|
|
|
```
|
|
|
|
|
|
|
|
Make a copy of the config_local example, which will be further edited as the application is
|
|
|
|
configured.
|
2017-03-07 13:59:43 +01:00
|
|
|
|
2018-06-22 16:09:29 +02:00
|
|
|
```
|
|
|
|
cp config_local.example.py config_local.py
|
|
|
|
```
|
|
|
|
|
|
|
|
Setup the database with the initial collections and the admin user.
|
|
|
|
|
|
|
|
```
|
|
|
|
./manage.py setup setup_db your_email
|
|
|
|
```
|
|
|
|
|
|
|
|
The command will return the following message:
|
2017-03-12 12:15:44 +01:00
|
|
|
|
2016-09-30 12:08:55 +02:00
|
|
|
```
|
2018-06-22 16:09:29 +02:00
|
|
|
Created project <project_id> for user <user_id>
|
|
|
|
```
|
|
|
|
|
|
|
|
Copy the value of `<project_id>` and assign it as value for `MAIN_PROJECT_ID`.
|
|
|
|
|
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
When ready to commit, change the remotes to work over SSH. For example:
|
|
|
|
|
|
|
|
`git remote set-url origin git@git.blender.org:blender-cloud.git`
|
2016-09-30 12:08:55 +02:00
|
|
|
|
2018-06-22 16:09:29 +02:00
|
|
|
For more information, check out [this guide](https://wiki.blender.org/wiki/Tools/Git#Commit_Access).
|
2017-03-07 13:59:43 +01:00
|
|
|
|
|
|
|
|
2018-02-02 11:47:29 +01:00
|
|
|
## Preparing the production branch for deployment
|
|
|
|
|
|
|
|
All revisions to deploy to production should be on the `production` branches of all the relevant
|
|
|
|
repositories.
|
2016-09-30 12:08:55 +02:00
|
|
|
|
2018-02-02 11:47:29 +01:00
|
|
|
Make sure you have these aliases in the `[alias]` section of your `~/.gitconfig`:
|
2016-09-30 12:08:55 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
prod = "!git checkout production && git fetch origin production && gitk --all"
|
|
|
|
ff = "merge --ff-only"
|
|
|
|
```
|
|
|
|
|
2018-02-02 11:47:29 +01:00
|
|
|
The following commands should be executed for each (sub)project; specifically for
|
|
|
|
the current repository, Pillar, Attract, Flamenco, and Pillar-SVNMan:
|
2016-09-30 12:08:55 +02:00
|
|
|
|
2016-08-17 15:17:47 +02:00
|
|
|
```
|
2016-09-30 12:08:55 +02:00
|
|
|
cd $projectdir
|
|
|
|
|
|
|
|
# Ensure there are no local, uncommitted changes.
|
|
|
|
git status
|
|
|
|
git stash # if you still have local stuff.
|
|
|
|
|
|
|
|
# pull from master, run unittests, push your changes to master.
|
|
|
|
git pull
|
|
|
|
py.test
|
|
|
|
git push
|
|
|
|
|
|
|
|
# Switch to production branch, and investigate the situation.
|
|
|
|
git prod
|
|
|
|
|
|
|
|
# Fast-forward the production branch to the master branch.
|
|
|
|
git ff master
|
|
|
|
|
|
|
|
# Run tests again
|
|
|
|
py.test
|
|
|
|
|
2018-02-02 11:47:29 +01:00
|
|
|
# Push the production branch.
|
|
|
|
git push
|
2016-09-30 12:08:55 +02:00
|
|
|
```
|
|
|
|
|
2018-02-02 11:47:29 +01:00
|
|
|
## Deploying to production server
|
2016-10-20 15:05:28 +02:00
|
|
|
|
2018-02-02 11:47:29 +01:00
|
|
|
```
|
|
|
|
workon blender-cloud # activate your virtualenv
|
|
|
|
cd $projectdir/deploy
|
|
|
|
./2docker.sh
|
2018-03-07 15:44:13 +01:00
|
|
|
./build-all.sh # or ./build-quick.sh
|
2018-02-02 12:20:00 +01:00
|
|
|
./2server.sh servername
|
2018-02-02 11:47:29 +01:00
|
|
|
```
|
2016-10-20 15:05:28 +02:00
|
|
|
|
2018-02-02 11:47:29 +01:00
|
|
|
To deploy another branch than `production`, do `export DEPLOY_BRANCH=otherbranch` before starting
|
|
|
|
the above commands.
|