mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 03:06:01 +02:00
Merge pull request #129 from cisagov/ik/build-deploy-script
Add build and deploy scripts
This commit is contained in:
commit
331d2e575a
8 changed files with 27 additions and 3 deletions
|
@ -49,9 +49,10 @@ cf target -o cisa-getgov-prototyping -s unstable
|
||||||
cf push getgov-unstable -f ops/manifests/manifest-unstable.yaml
|
cf push getgov-unstable -f ops/manifests/manifest-unstable.yaml
|
||||||
cf run-task getgov-unstable --command 'python manage.py migrate' --name migrate
|
cf run-task getgov-unstable --command 'python manage.py migrate' --name migrate
|
||||||
```
|
```
|
||||||
|
Alternatively, you could run the `deploy.sh` script in the `/src` directory to build the assets and deploy to `unstable`. Similarly, you could run `build.sh` script to just compile and collect the assets without deploying.
|
||||||
|
|
||||||
|
|
||||||
## Serving static assets
|
## Serving static assets
|
||||||
We are using [WhiteNoise](http://whitenoise.evans.io/en/stable/index.html) plugin to serve our static assets on cloud.gov. This plugin is added to the `MIDDLEWARE` list in our apps `settings.py`.
|
We are using [WhiteNoise](http://whitenoise.evans.io/en/stable/index.html) plugin to serve our static assets on cloud.gov. This plugin is added to the `MIDDLEWARE` list in our apps `settings.py`.
|
||||||
|
|
||||||
Note that it’s a good idea to run `collectstatic` locally or in the docker container before pushing files up to `unstable`. This is because `collectstatic` relies on timestamps when deciding to whether to overwrite the existing assets in `/public`. Due the way files are uploaded, the compiled css in the `/assets/css` folder on `unstable` will have a slightly earlier timestamp than the files in `/public/css`, and consequently running `collectstatic` on`unstable` will not update `public/css` as you may expect.
|
Note that it’s a good idea to run `collectstatic` locally or in the docker container before pushing files up to `unstable`. This is because `collectstatic` relies on timestamps when deciding to whether to overwrite the existing assets in `/public`. Due the way files are uploaded, the compiled css in the `/assets/css` folder on `unstable` will have a slightly earlier timestamp than the files in `/public/css`, and consequently running `collectstatic` on`unstable` will not update `public/css` as you may expect. For convenience, both the `deploy.sh` and `build.sh` scripts will take care of that.
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
|
|
||||||
This directory contains files related to deploying or running the application(s).
|
This directory contains files related to deploying or running the application(s).
|
||||||
|
|
||||||
Documentation is in [docs/ops](../docs/ops).
|
Documentation is in [docs/ops](../docs/operations/).
|
||||||
|
|
8
ops/scripts/build.sh
Executable file
8
ops/scripts/build.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Compile assets
|
||||||
|
docker compose run node npx gulp compile;
|
||||||
|
docker compose run node npx gulp copyAssets;
|
||||||
|
|
||||||
|
# Collect assets
|
||||||
|
docker compose run app python manage.py collectstatic --noinput
|
10
ops/scripts/deploy.sh
Executable file
10
ops/scripts/deploy.sh
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Compile and collect static assets
|
||||||
|
../ops/scripts/build.sh
|
||||||
|
|
||||||
|
# Deploy to unstable
|
||||||
|
cf target -o cisa-getgov-prototyping -s unstable
|
||||||
|
cf push getgov-unstable -f ../ops/manifests/manifest-unstable.yaml
|
||||||
|
|
||||||
|
cf run-task getgov-unstable --command 'python manage.py migrate' --name migrate
|
1
src/build.sh
Symbolic link
1
src/build.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../ops/scripts/build.sh
|
1
src/deploy.sh
Symbolic link
1
src/deploy.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../ops/scripts/deploy.sh
|
|
@ -26,3 +26,4 @@ i.e.
|
||||||
p {
|
p {
|
||||||
color: color('blue-10v');
|
color: color('blue-10v');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,7 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python manage.py collectstatic --settings=registrar.config.settings --noinput
|
# Make sure that django's `collectstatic` has been run locally before pushing up to unstable,
|
||||||
|
# so that the styles and static assets to show up correctly on unstable.
|
||||||
|
|
||||||
gunicorn registrar.config.wsgi -t 60
|
gunicorn registrar.config.wsgi -t 60
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue