Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod deploy fixes #70

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions {{cookiecutter.repostory_name}}/README.md
Original file line number Diff line number Diff line change
@@ -74,14 +74,15 @@ git push production master
# remote server
cd ~/repos/{{ cookiecutter.repostory_name }}.git

cat <<EOT >> hooks/post-receive
cat <<'EOT' > hooks/post-receive
#!/bin/bash
unset GIT_INDEX_FILE
export ROOT=/root
export REPO={{ cookiecutter.repostory_name }}
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]]; then
echo "Deploying revision $newrev pushed to $ref."
export GIT_DIR="$ROOT/repos/$REPO.git/"
export GIT_WORK_TREE="$ROOT/domains/$REPO/"
git checkout -f master
@@ -94,12 +95,24 @@ done
EOT

chmod +x hooks/post-receive
./hooks/post-receive
echo "_ _ production/master" | ./hooks/post-receive
```

Please note that first hook execution (deployment) will fail.

Continue with production environment day one setup:

```sh
# remote server
cd ~/domains/{{ cookiecutter.repostory_name }}
./setup-prod.sh
```

# adjust the `.env` file
Adjust the `.env` file (`SECRET_KEY`, `POSTGRES_PASSWORD` etc.)

Setup certificates:
```sh
# remote server
mkdir letsencrypt
./letsencrypt_setup.sh
./deploy.sh