Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 14 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
.git
.buildkite
.gitignore
.env
.prettierignore
.stylelintrc
.editorconfig
.vscode
env
mounts
*.pyc
__pycache__/
settings.py
celeryconfig.py
web/settings.py
web/settings.*.py
web/celeryconfig.py
web/celeryconfig.*.py
.eggs/
build/
html/
pip-log.txt
.DS_Store
*.swp
.deploy.env
README.md
LICENSE
web/yoyo.*.ini
web/yoyo.ini
Makefile
12 changes: 6 additions & 6 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v6
with:
file: ./Dockerfile
file: ./setup/web/Dockerfile
context: .
push: true
tags: mltshp/mltshp-web:build-${{ env.build_number }}
Expand All @@ -56,7 +56,7 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v6
with:
file: ./Dockerfile.worker
file: ./setup/worker/Dockerfile
context: .
push: true
tags: mltshp/mltshp-worker:build-${{ env.build_number }}
Expand All @@ -69,22 +69,22 @@ jobs:
uses: actions/checkout@v4

- name: Start services with Docker Compose
run: docker compose -f release/docker-compose.yml up -d
run: docker compose -f setup/test/docker-compose.yml --project-directory=. up -d

- name: Wait for services to be ready
run: sleep 10

- name: Run tests
run: docker exec -t release-mltshp-1 ./run-tests.sh
run: docker exec -t mltshp-mltshp-1 ./test/run-tests.sh

- name: Run Coveralls report
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: docker exec -t -e COVERALLS_REPO_TOKEN release-mltshp-1 ./coveralls-report.sh
run: docker exec -t -e COVERALLS_REPO_TOKEN mltshp-mltshp-1 ./test/coveralls-report.sh

- name: Stop services and clean up
run: |
docker compose -f release/docker-compose.yml down
docker compose -f setup/test/docker-compose.yml --project-directory=. down
docker container prune -f

staging:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
uses: actions/checkout@v4

- name: Build and start services with Docker Compose
run: docker compose -f release/docker-compose.yml up -d --build
run: docker compose -f setup/test/docker-compose.yml --project-directory=. up -d --build

- name: Wait for services to be ready
run: sleep 10

- name: Run tests
run: docker exec -t release-mltshp-1 ./run-tests.sh
run: docker exec -t mltshp-mltshp-1 ./test/run-tests.sh

- name: Stop services and clean up
run: |
docker compose -f release/docker-compose.yml down
docker compose -f setup/test/docker-compose.yml --project-directory=. down
docker container prune -f
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
*.pyc
/settings.py
celeryconfig.py
web/settings.py
web/settings.*.py
web/yoyo.ini
web/yoyo.*.ini
web/celeryconfig.py
.eggs/
build/
html/
.figleaf
pip-log.txt
.DS_Store
*.swp
env
mounts
.env
.deploy.env
.*.env
.coverage
coverage.xml
.vscode/
6 changes: 3 additions & 3 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"declaration-colon-space-before": "never",
"declaration-empty-line-before": "never",
"declaration-block-no-duplicate-properties": [ true, {
ignore: ["consecutive-duplicates-with-different-values"],
"ignore": ["consecutive-duplicates-with-different-values"],
} ],
"declaration-block-no-ignored-properties": true,
"declaration-block-no-redundant-longhand-properties": true,
Expand Down Expand Up @@ -82,10 +82,10 @@
"selector-list-comma-newline-after": "always",
"selector-list-comma-space-before": "never",
"rule-nested-empty-line-before": [ "always-multi-line", {
ignore: ["after-comment"],
"ignore": ["after-comment"],
} ],
"rule-non-nested-empty-line-before": [ "always-multi-line", {
ignore: ["after-comment"],
"ignore": ["after-comment"],
} ],
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
Expand Down
72 changes: 0 additions & 72 deletions Dockerfile

This file was deleted.

45 changes: 0 additions & 45 deletions Dockerfile.worker

This file was deleted.

34 changes: 21 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
.PHONY: init start stop custom-build build shell test destroy migrate mysql
.PHONY: init start stop custom-build build shell test destroy migrate mysql straw

init:
cp settings.example.py settings.py
cp celeryconfig.example.py celeryconfig.py
mkdir -p mounts/mysql mounts/logs mounts/fakes3 mounts/uploaded
cp web/settings.example.py web/settings.py
cp web/celeryconfig.example.py web/celeryconfig.py
mkdir -p mounts/mysql mounts/logs mounts/fakes3 mounts/uploaded \
mounts/tmpuploads/0 mounts/tmpuploads/1 mounts/tmpuploads/2 \
mounts/tmpuploads/3 mounts/tmpuploads/4 mounts/tmpuploads/5 \
mounts/tmpuploads/6 mounts/tmpuploads/7 mounts/tmpuploads/8 \
mounts/tmpuploads/9

start:
docker compose up -d
docker compose -f setup/web/docker-compose.dev.yml --project-directory=. up -d

stop:
docker compose down
docker compose -f setup/web/docker-compose.dev.yml --project-directory=. down

custom-build:
@read -p "build tag (default is 'latest'): " build_tag; \
docker build -t mltshp/mltshp-web:$${build_tag:-latest}
docker build -f setup/web/Dockerfile -t mltshp/mltshp-web:$${build_tag:-latest}

build:
docker build -t mltshp/mltshp-web:latest .
docker build -f setup/web/Dockerfile -t mltshp/mltshp-web:latest .

shell:
docker compose exec mltshp bash
docker compose -f setup/web/docker-compose.dev.yml --project-directory=. exec web ash

test:
docker compose exec mltshp su mltshp -c "cd /srv/mltshp.com/mltshp; python3 -u test.py $(TEST)"
docker compose -f setup/test/docker-compose.yml --project-directory=. exec web su mltshp -c "python3 -u test/test.py $(TEST)"

destroy:
docker compose down && rm -rf mounts
docker compose -f setup/web/docker-compose.dev.yml --project-directory=. down && rm -rf mounts

migrate:
docker compose exec mltshp su mltshp -c "cd /srv/mltshp.com/mltshp; python3 migrate.py"
docker compose -f setup/web/docker-compose.dev.yml --project-directory=. exec web su mltshp -c "cd /srv/mltshp.com/mltshp; python3 migrate.py"

mysql:
docker compose exec mltshp su mltshp -c "cd /srv/mltshp.com/mltshp; mysql -u root --host mysql mltshp"
docker compose -f setup/web/docker-compose.dev.yml --project-directory=. exec web su mltshp -c "cd /srv/mltshp.com/mltshp; mysql -u root --host mysql mltshp"

web/static/straw/compact.js: web/static/straw/source.js
closure-compiler --js web/static/straw/source.js --js_output_file web/static/straw/compact.js || echo "closure-compiler not found"

38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Project Description

This project is the codebase for running [mltshp.com](https://mltshp.com).
It's a Python 3 application, utilizing a MySQL database, Amazon S3 for
It's a Python 3 application, utilizing a MySQL database, Backblaze B2 for
asset storage, and RabbitMQ for background jobs.

## Development Environment
Expand Down Expand Up @@ -97,26 +97,13 @@ The directory structure looks like this:
* mysql/
* (mysql data files)

## AWS S3 Storage
## S3 Storage

MLTSHP utilizes AWS S3 for storing uploaded images. The development
environment provides a dummy S3 server for local operation. But it requires
a license key in order to use it. Visit [this page](https://supso.org/projects/fake-s3)
to obtain a license key. For individual developers and small organizations,
there is no cost. Add the following to a local `.env` file in the root
of the project:

```
FAKES3_LICENSE_KEY=your-license-key-here
```
MLTSHP utilizes S3 for storing uploaded images. The development
environment provides a dummy S3 server for local operation.

You will find any uploaded files under the `mounts/fakes3' directory.

**Note:** As of this time, the Docker image for the fake S3 server is
incompatible with Apple Silicon CPU architectures. If you are using a
computer with an Apple ARM CPU, you will need to use a real S3 bucket
(see below).

If you would rather use a real S3 bucket, you can do that too. Create
one and then assign these in your local settings.py file:

Expand Down Expand Up @@ -203,6 +190,23 @@ $ make stop

Then, run another `make start`.

## Straw

There's one resource that requires manual compilation when it is updated.
That's the `static/straw/source.js` script. This script is for the bookmkarklet
for MLTSHP. It can be compiled using this command:

```shell
$ make straw
```

After this, you'll need to check in the modified source.js and compact.js
files.

The command requires that the `closure-compiler` binary is available. This
can be installed via Homebrew (`brew install closure-compiler`) or your
favorite package manager.

## Relationship with MLTSHP-Patterns

The CSS in this repo is just the compiled version of the styles from the MLTSHP
Expand Down
Loading