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

Update setup instructions #174

Merged
merged 10 commits into from
Sep 4, 2023
2 changes: 1 addition & 1 deletion dev.env → .circleci/circleci.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PORT_PREFIX=520
ENVIRONMENT=dev
APPLICATION_VERSION=0.1
PROJECT=madewithwagtail
SITE_HOSTNAME=madewithwagtail-dev.springload.nz
SITE_HOSTNAME=madewithwagtail.dev.springload.nz
DATABASE_URL=postgres://postgres:postgres@database/madewithwagtail
DJANGO_SETTINGS_MODULE=madewithwagtail.settings.dev
APP_SECRET_KEY=111
Expand Down
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ media/*
.coverage
.bundle
dev.env
temp/

docker/database/*.sql

Expand Down
104 changes: 65 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,77 +5,103 @@

*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 [email protected]: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
```

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``.
And then edit `dev.env` to suit your local setup. Any API keys etc should be in Bitwarden.

### Front-end installation
### Database setup

> Install [Node](https://nodejs.org). This project also uses [nvm](https://github.com/creationix/nvm).
First, download the database dump you want from our [Google Cloud storage](<https://console.cloud.google.com/storage/browser/springload-backups/madewithwagtail?pageState=(%22StorageObjectListTable%22:(%22f%22:%22%255B%255D%22))&project=springload-backups&prefix=&forceOnObjectsSortingFiltering=false>).

To install our dependencies:
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.

### Build your containers

```sh
nvm install
# Then, install all project dependencies.
npm install
docker-compose up
# In another terminal tab run:
docker-compose exec application ./manage.py migrate
```

## Working on the project
### Change cms-superadmin password

> Everything mentioned in the installation process should already be done.
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:**
Expand All @@ -85,7 +111,7 @@ pushing to the deploy branch. That way you know that both are up to date.
| 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 |
Expand Down
1 change: 0 additions & 1 deletion core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion core/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 0 additions & 2 deletions core/templatetags/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -93,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]
Expand Down
4 changes: 2 additions & 2 deletions dev.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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