From 0f38950e5d8ed657d272215ac70a04877d9f81e6 Mon Sep 17 00:00:00 2001 From: Andrew Calder Date: Mon, 4 Sep 2023 11:38:08 +1200 Subject: [PATCH 01/10] Update README --- README.md | 106 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 48107a2..f7c4fe7 100644 --- a/README.md +++ b/README.md @@ -5,77 +5,107 @@ *Check out [Awesome Wagtail](https://github.com/springload/awesome-wagtail) for more awesome packages and resources from the Wagtail community.* -## Installation +## Back End Setup -Install [Vagrant](http://www.vagrantup.com/downloads.html) and [VirtualBox](https://www.virtualbox.org/wiki/Downloads), then from the command-line: +Development on this project can be done using docker. If you have not yet +installed docker, consult the instructions for your operating system. + +[Docker](https://docs.docker.com/) + +It's a good idea to set up the nginx proxy if you have not done so already, +instructions can be found on the github repo. + +Vagrant is no longer in this project, and any material relating to vagrant +can be ignored. + +## Clone the repo ```sh +cd [my-dev-environment] git clone git@github.com:springload/madewithwagtail.git cd madewithwagtail -.githooks/deploy -vagrant up -# [.. wait until everything gets installed] -vagrant ssh -# [.. from your vagrant machine] -djrun ``` +### Setup your environment variables + +```sh +cp dev.env.example dev.env +``` + +And then edit `dev.env` to suit your local setup. Any API keys etc should be in Bitwarden. -The demo site will now be accessible at [http://localhost:8111/](http://localhost:8111/) and the Wagtail admin interface at [http://localhost:8111/admin/](http://localhost:8111/admin/) . Log into the admin with the credentials ``admin / changeme``. +### Database setup -### Front-end installation +First, download the database dump you want from our [Google Cloud storage](). -> Install [Node](https://nodejs.org). This project also uses [nvm](https://github.com/creationix/nvm). +Next decrypt the dump using gpg. -To install our dependencies: +Finally, place the decrypted .sql file into [my-dev-environment]/madewithwagtail/docker/database - it will be automatically loaded when you build your database container in the next section. ```sh -nvm install -# Then, install all project dependencies. -npm install +cp /SOMEWHERE/DECRYPTED_DB_DUMP.sql ./docker/database ``` -## Working on the project +### Build your containers -> Everything mentioned in the installation process should already be done. +```sh +docker-compose up +# In another terminal tab run: +docker-compose exec application ./manage.py migrate +``` + +### Change cms-superadmin password + +When you load the DB dump, the wagtail cms-superadmin login will have the +password assigned to the environment from which the DB dump came. -### Starting the server +To set it to something else use this command: ```sh -vagrant up -vagrant ssh -djrun +docker-compose exec application ./manage.py changepassword cms-superadmin ``` -### Front-end commands +### Default site + +You may need to delete and re-create your site object via the CMS to avoid weird errors in docker. + +### Browsing locally + +**https://madewithwagtail.dev.springload.nz/** + +## Front End + +This project uses [nvm](https://github.com/creationix/nvm) and [Yarn](https://yarnpkg.com/lang/en/) ```sh # Make sure you use the right node version. nvm use + +# Setup +yarn install + # Start the server and the development tools. -npm run start +yarn run start + # Builds frontend assets. -npm run build -# Runs linting. -npm run lint:versions -# Runs tests. -npm run test -# View other available commands with: -npm run -``` +yarn run build -## Deploying a new version +# Builds frontend production assets. +yarn run dist -### To production +# Runs linting. +yarn run lint -```sh -npm run deploy -``` +# Runs tests. +yarn run test -From your local machine, it's a good idea to push to the master before -pushing to the deploy branch. That way you know that both are up to date. +# View other available commands with: +yarn run +``` ## Documentation +Check out the [`docs/`](docs/) in their own folder. + ### Browser support **Supported browser / device versions:** From 2470ef435d38b18ec3d35bc59e0f31d027672d02 Mon Sep 17 00:00:00 2001 From: Andrew Calder Date: Mon, 4 Sep 2023 11:39:45 +1200 Subject: [PATCH 02/10] Remove dev.env from git --- dev.env | 9 --------- dev.env.example | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 dev.env diff --git a/dev.env b/dev.env deleted file mode 100644 index 07bddb0..0000000 --- a/dev.env +++ /dev/null @@ -1,9 +0,0 @@ -PORT_PREFIX=520 -ENVIRONMENT=dev -APPLICATION_VERSION=0.1 -PROJECT=madewithwagtail -SITE_HOSTNAME=madewithwagtail-dev.springload.nz -DATABASE_URL=postgres://postgres:postgres@database/madewithwagtail -DJANGO_SETTINGS_MODULE=madewithwagtail.settings.dev -APP_SECRET_KEY=111 -DEV_SHOW_DEBUG_TOOLBAR=False diff --git a/dev.env.example b/dev.env.example index 51db07c..f36e406 100644 --- a/dev.env.example +++ b/dev.env.example @@ -2,8 +2,8 @@ PORT_PREFIX=520 ENVIRONMENT=dev APPLICATION_VERSION=0.1 PROJECT=madewithwagtail -SITE_HOSTNAME=madewithwagtail-dev.springload.nz -DATABASE_URL=postgres://postgres@database/madewithwagtail +SITE_HOSTNAME=madewithwagtail.dev.springload.nz +DATABASE_URL=postgres://postgres:postgres@database/madewithwagtail DJANGO_SETTINGS_MODULE=madewithwagtail.settings.dev APP_SECRET_KEY=111 DEV_SHOW_DEBUG_TOOLBAR=False From 9753c5ce2e9daea87e23c8a61b84dd67c28e379a Mon Sep 17 00:00:00 2001 From: Andrew Calder Date: Mon, 4 Sep 2023 11:42:22 +1200 Subject: [PATCH 03/10] Update README - tidy DB instructions --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index f7c4fe7..7e2825e 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,6 @@ Next decrypt the dump using gpg. Finally, place the decrypted .sql file into [my-dev-environment]/madewithwagtail/docker/database - it will be automatically loaded when you build your database container in the next section. -```sh -cp /SOMEWHERE/DECRYPTED_DB_DUMP.sql ./docker/database -``` - ### Build your containers ```sh From 4cdd61773072e4ef657d1d3f506b4aa60f5bb0b5 Mon Sep 17 00:00:00 2001 From: Andrew Calder Date: Mon, 4 Sep 2023 11:52:49 +1200 Subject: [PATCH 04/10] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d4870d4..7d56a07 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ media/* .coverage .bundle dev.env +temp/ docker/database/*.sql From eedbdec94112c606a09d58617fde8383cb5fe6bd Mon Sep 17 00:00:00 2001 From: Andrew Calder Date: Mon, 4 Sep 2023 12:08:02 +1200 Subject: [PATCH 05/10] Update supported browsers --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e2825e..529cd3e 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ Check out the [`docs/`](docs/) in their own folder. | Mobile Safari | iOS Phone | latest | | Mobile Safari | iOS Tablet | latest | | Chrome | Android | latest | -| IE | Desktop | 11 | +| Edge | Desktop | latest | | Chrome | Desktop | latest | | Firefox | Desktop | latest | | Safari | OSX | latest | From d3b560ef6cd61a06588288f7424f9760770367ef Mon Sep 17 00:00:00 2001 From: Andrew Calder Date: Mon, 4 Sep 2023 12:13:10 +1200 Subject: [PATCH 06/10] Fix linting --- core/templatetags/macros.py | 1 - 1 file changed, 1 deletion(-) diff --git a/core/templatetags/macros.py b/core/templatetags/macros.py index 0ce9d5d..d630d42 100644 --- a/core/templatetags/macros.py +++ b/core/templatetags/macros.py @@ -20,7 +20,6 @@ def _setup_macros_dict(parser): class DefineMacroNode(template.Node): def __init__(self, name, nodelist, args): - self.name = name self.nodelist = nodelist self.args = [] From 42b603591c12f0fd613b2c7e4e20e04a96568644 Mon Sep 17 00:00:00 2001 From: Andrew Calder Date: Mon, 4 Sep 2023 12:21:16 +1200 Subject: [PATCH 07/10] Fix linting --- core/context_processors.py | 1 - core/snippets.py | 1 - core/templatetags/macros.py | 1 - 3 files changed, 3 deletions(-) diff --git a/core/context_processors.py b/core/context_processors.py index 6d375e2..856924a 100644 --- a/core/context_processors.py +++ b/core/context_processors.py @@ -2,7 +2,6 @@ def google_credentials(request): - return { "GOOGLE_ANALYTICS_KEY": getattr(settings, "GOOGLE_ANALYTICS_KEY", False), "GOOGLE_TAG_MANAGER": getattr(settings, "GOOGLE_TAG_MANAGER", False), diff --git a/core/snippets.py b/core/snippets.py index 057212c..eebc137 100644 --- a/core/snippets.py +++ b/core/snippets.py @@ -160,7 +160,6 @@ def get_by_natural_key(self, name): @register_snippet class NavigationMenu(ClusterableModel): - objects = NavigationMenuManager() menu_name = models.CharField(max_length=255, null=False, blank=False) diff --git a/core/templatetags/macros.py b/core/templatetags/macros.py index d630d42..47c6e7a 100644 --- a/core/templatetags/macros.py +++ b/core/templatetags/macros.py @@ -92,7 +92,6 @@ def __init__(self, macro, fe_args, fe_kwargs, context_only): self.context_only = context_only def render(self, context): - for i, arg in enumerate(self.macro.args): try: fe = self.fe_args[i] From 7861252a4eb299909a510e649ec139290bc11a75 Mon Sep 17 00:00:00 2001 From: Andrew Calder Date: Mon, 4 Sep 2023 12:26:39 +1200 Subject: [PATCH 08/10] Attempt to fix circleci which broke when I did the sensible thing to the env file.. --- .circleci/circleci.env | 9 +++++++++ .circleci/config.yml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .circleci/circleci.env diff --git a/.circleci/circleci.env b/.circleci/circleci.env new file mode 100644 index 0000000..f36e406 --- /dev/null +++ b/.circleci/circleci.env @@ -0,0 +1,9 @@ +PORT_PREFIX=520 +ENVIRONMENT=dev +APPLICATION_VERSION=0.1 +PROJECT=madewithwagtail +SITE_HOSTNAME=madewithwagtail.dev.springload.nz +DATABASE_URL=postgres://postgres:postgres@database/madewithwagtail +DJANGO_SETTINGS_MODULE=madewithwagtail.settings.dev +APP_SECRET_KEY=111 +DEV_SHOW_DEBUG_TOOLBAR=False diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e7c427..6dadd00 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,7 @@ workflows: docker run \ -it --name app-test --rm \ --link=database \ - --env-file=dev.env \ + --env-file=.circleci/circleci.env \ -e DATABASE_URL="postgres://postgres:$DATABASE_PASSWORD@database/${PROJECT}_test" \ -e ENVIRONMENT=test \ app-test From ff79859a184b704f15b7fe55425147cea4f2054d Mon Sep 17 00:00:00 2001 From: Andrew Calder <92233792+AndrewCalderSpringload@users.noreply.github.com> Date: Mon, 4 Sep 2023 13:49:38 +1200 Subject: [PATCH 09/10] Update .circleci/config.yml Co-authored-by: Haydn Greatnews --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6dadd00..6bf9d4c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,7 @@ workflows: docker run \ -it --name app-test --rm \ --link=database \ - --env-file=.circleci/circleci.env \ + --env-file=dev.env.example \ -e DATABASE_URL="postgres://postgres:$DATABASE_PASSWORD@database/${PROJECT}_test" \ -e ENVIRONMENT=test \ app-test From 11dab9991f7d65a7d7a6df9140c11c2af7b4e55c Mon Sep 17 00:00:00 2001 From: Andrew Calder Date: Mon, 4 Sep 2023 14:11:14 +1200 Subject: [PATCH 10/10] Remove a couple of unneeded sections --- README.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/README.md b/README.md index 529cd3e..7e73a30 100644 --- a/README.md +++ b/README.md @@ -49,21 +49,6 @@ docker-compose up docker-compose exec application ./manage.py migrate ``` -### Change cms-superadmin password - -When you load the DB dump, the wagtail cms-superadmin login will have the -password assigned to the environment from which the DB dump came. - -To set it to something else use this command: - -```sh -docker-compose exec application ./manage.py changepassword cms-superadmin -``` - -### Default site - -You may need to delete and re-create your site object via the CMS to avoid weird errors in docker. - ### Browsing locally **https://madewithwagtail.dev.springload.nz/**