0

I building a simple web app AngularJS and Flask (REST arch.) I'm using yeoman to generate all boilerplate. The problem is with heroku hosting which requires deploying through git. The structure of project:

client <- content generated by yeoman
server
|-- static
|-- venv
server.py <- flask
Procfile
.gitifnore
...

I modified grunt script so at the end dist folder is copied to static. For now dist is in .gitignore, but I'm thinking about a few possible solutions

  1. Sepreate repo for deployment
  2. Commiting to every build
  3. Build on Heroku

Every one has pros and cons (Don't know if 3. is even possible). Is there a better way?

EDIT:

Here is current state of affair. grunt copy dist client to heroku\static and for now I manually copy server. But I'm not sure how to push it to heroku. git subtree push --prefix heroku heroku master gives me rejected msg. I set remotes and try all combinations, but no success so far.

.git 
.gitignore
README.md
client
heroku
   .git
   static
   Procfile
   requriements.txt 
server
Lukasz Madon
  • 14,664
  • 14
  • 64
  • 108

2 Answers2

1

As for the first option: check out this SO thread - basically with git-subtree you can have a separate repo for builds and avoid polluting dev repo with production commits.
Because of this 2nd option makes no sense.

Community
  • 1
  • 1
vucalur
  • 6,007
  • 3
  • 29
  • 46
0

I end up having separate repo and managing it with invoke. Here is the build script.

from invoke import run, task

@task
def clean():
  run("rm -rf heroku/*")
  run("cd client && grunt clean")

@task
def build():
  run("cd client && grunt")

@task
def deploy():
  run("mkdir heroku/static && cp -r client/dist/* heroku/static/")
  run("rsync -av --exclude='venv' --exclude='local_server.py' server/ heroku")
  msg = run("git log -1 --pretty=%B").stdout
  run("cd heroku && git add --all && git commit -m '%s' && git push heroku master" % (msg,))

@task("clean", "build", "deploy")
def all():
  pass
Lukasz Madon
  • 14,664
  • 14
  • 64
  • 108