Skip to content

Commit

Permalink
Fix Docker build issues and refactor Fabfile (#392)
Browse files Browse the repository at this point in the history
Co-authored-by: Meagen Voss <[email protected]>
  • Loading branch information
RealOrangeOne and vossisboss authored Oct 7, 2023
1 parent 932da2d commit 4027541
Show file tree
Hide file tree
Showing 9 changed files with 250 additions and 355 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ node_modules
/wagtailio/static_compiled
.idea
/.python-version
/database_dumps
9 changes: 0 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ FROM backend AS dev
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install -y nodejs

# Install Heroku CLI
RUN curl https://cli-assets.heroku.com/install.sh | sh

# Install AWS CLI
RUN curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "/tmp/awscli-bundle.zip" && \
unzip /tmp/awscli-bundle.zip -d /tmp && \
/tmp/awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws && \
rm /tmp/awscli-bundle.zip && rm -r /tmp/awscli-bundle

# Switch to the application user
USER wagtailio

Expand Down
15 changes: 3 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ build: ## 🔨 - Build Docker container
start: ## 🎬 - Start containers
docker-compose up

sh: ## Enter the web container
docker-compose exec web bash

runserver: ## 🏃 - Run Django server
docker-compose exec web django-admin runserver 0.0.0.0:8000

Expand All @@ -32,15 +35,3 @@ migrations: ## 🧳 - Make migrations

migrate: ## 🧳 - Migrate
docker-compose run web django-admin migrate

pull-production-data: ## ⬇️ - Pull production data
docker-compose run web fab pull_production_data

pull-production-media: ## 📸 - Pull production media
docker-compose run web fab pull_production_media

pull-staging-data: ## ⬇️ - Pull production data
docker-compose run web fab pull_staging_data

pull-staging-media: ## 📸 - Pull production media
docker-compose run web fab pull_staging_media
27 changes: 11 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ This is the source code to [Wagtail's website](https://wagtail.org)

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/wagtail/wagtail.org)

## Requirements

- Docker or Vagrant (see below)
- [Fabric](https://www.fabfile.org/), [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) and [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) (only for downloading production / staging data)

## Installation (Docker Compose)

You firstly need to install [git](https://git-scm.com), [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/). Once they are installed, run the following commands to get up and running:
You first need to install [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/). Once they are installed, run the following commands to get up and running:

```
git clone https://github.com/wagtail/wagtail.org.git
Expand Down Expand Up @@ -51,15 +56,15 @@ make superuser
If you'd like to work with production data and have access, run the following commands:

```
make pull-production-data
make pull-production-media
fab pull-production-data
fab pull-production-media
```

(you will be prompted to log in to Heroku both times. To log in, hit enter when it asks you and copy and paste the URL it gives you into a browser)
Access will only be given when absolutely necessary.

## Installation (Vagrant)

You firstly need to install [git](https://git-scm.com), [Vagrant](https://www.vagrantup.com/) and [Virtualbox](https://www.virtualbox.org/). Once they are installed, run the following commands to get up and running:
You first need to install [Vagrant](https://www.vagrantup.com/) and [Virtualbox](https://www.virtualbox.org/). Once they are installed, run the following commands to get up and running:

```
git clone https://github.com/wagtail/wagtail.org.git
Expand Down Expand Up @@ -113,17 +118,7 @@ For more info see [Frontend general info](docs/frontend/general-info.md)

## Deployment

The site is hosted on heroku, and is deployed by pushing to the heroku remote.

Creating and pushing to the heroku branch is handled automatically by fabric command.

To staging

`fab deploy_staging`

To production

`fab deploy_production`
The site is hosted on Heroku, and is deployed automatically. `main` deploys to production, and `staging` deploys to staging.

## docs.wagtail.org

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ services:
POSTGRES_HOST_AUTH_METHOD: trust
logging:
driver: none
volumes:
- .:/app:ro
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U wagtailorg']
interval: 5s
Expand Down
Loading

0 comments on commit 4027541

Please sign in to comment.