forked from jkenlooper/puzzle-massive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Based from the 2.0.0 version at the archived repo hosted on GitLab https://gitlab.com/jkenlooper/puzzle-massive
- Loading branch information
1 parent
068bd72
commit db494c2
Showing
356 changed files
with
16,234 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["env"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/dist/** binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
*.DS_Store | ||
/.env | ||
/.htpasswd | ||
/site.cfg | ||
/frozen.tar.gz | ||
/web/puzzle-massive.conf | ||
/stats/awstats.puzzle.massive.xyz.conf | ||
/stats/awstats-puzzle-massive-crontab | ||
/chill/puzzle-massive-chill.service | ||
/api/puzzle-massive-api.service | ||
/api/puzzle-massive-artist.service | ||
/api/puzzle-massive-janitor.service | ||
/divulger/puzzle-massive-divulger.service | ||
/db | ||
/dist/ | ||
/frozen/ | ||
/logs/ | ||
/node_modules/ | ||
/npm-debug.log | ||
/src/*/*.tmp.css | ||
/src/*/*.tmp.css.map | ||
/src/*/*.tmp.js | ||
/src/*/*.tmp.js.map | ||
/puzzle-massive/* | ||
!/puzzle-massive/MANIFEST | ||
|
||
/web/dhparam.pem | ||
/web/rootCA.key | ||
/web/rootCA.pem | ||
/web/rootCA.srl | ||
/web/server.crt | ||
/web/server.csr | ||
/web/server.key | ||
|
||
/include/ | ||
/lib/ | ||
/local/ | ||
/share/ | ||
/pysqlite2-doc/ | ||
|
||
*.pyc | ||
*.egg-info/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, sex characteristics, gender identity and expression, | ||
level of experience, education, socio-economic status, nationality, personal | ||
appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Guide on Contributing | ||
|
||
Thanks for your interest in Puzzle Massive! I am totally open for any help with | ||
this project. This doesn't just mean programming help, but also help with | ||
documentation, ideas, design, etc.. | ||
|
||
There is also this helpful guide on | ||
[How to contribute to an open source project](https://opensource.guide/how-to-contribute/). | ||
|
||
## Bug Reports | ||
|
||
Found a bug or 'undocumented feature'? Please create an issue on this project | ||
with as much detail as necessary in how to reproduce it if applicable. It might | ||
just be specific to the web browser that you are using, so add the name of the | ||
browser as well. | ||
|
||
## New Features | ||
|
||
I'm always open to new ideas and improvements to Puzzle Massive that would make | ||
it more fun and entertaining to the masses. If you would like to discuss it | ||
first casually via chat or email that is okay. You can also create a new issue | ||
for the new feature and discuss it in the comments section there. | ||
|
||
Before diving in to the code with your new feature idea, just give me the heads | ||
up at least. And don't forget to ask for help if you get stuck. This | ||
application is built on lost llamas | ||
([chill](https://github.com/jkenlooper/chill)) and may have some things that are | ||
not obvious. | ||
|
||
# Goal of Puzzle Massive | ||
|
||
The reason I built this web application was not directly for monetary reasons. | ||
It is more of a fun side project for me and I plan to keep it that way. | ||
I hope that someone else can learn from a project like this and be inspired to | ||
make something that is awesome, too. Of course running a server to host Puzzle | ||
Massive on does cost me some money, I'm fine with that and hope to have that | ||
cost covered via sponsors and such. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
MAKEFLAGS += --warn-undefined-variables | ||
SHELL := bash | ||
.SHELLFLAGS := -eu -o pipefail -c | ||
.DEFAULT_GOAL := all | ||
.DELETE_ON_ERROR: | ||
.SUFFIXES: | ||
|
||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
project_dir := $(dir $(mkfile_path)) | ||
|
||
# Local pip is used by creating virtualenv and running `source ./bin/activate` | ||
|
||
# all: the name of the default target | ||
# check: runs tests, linters, and style enforcers | ||
# clean: removes files created by all | ||
# install: | ||
# uninstall: undoes what install did | ||
|
||
# Workflow should be: | ||
# sudo ./init.sh; # Sets up a new ubuntu server with base stuff and dev user | ||
# sudo ./bin/setup.sh # should only need to be run once | ||
# virtualenv .; | ||
# source ./bin/activate; | ||
# make ENVIRONMENT=development; | ||
# sudo make ENVIRONMENT=development install; | ||
# | ||
# sudo make ENVIRONMENT=development uninstall; | ||
# make ENVIRONMENT=development clean; | ||
# | ||
|
||
#Use order only prerequisites for making directories | ||
|
||
# Set to tmp/ when debugging the install | ||
# make PREFIXDIR=${PWD}/tmp inspect.SRVDIR | ||
# make PREFIXDIR=${PWD}/tmp ENVIRONMENT=development install | ||
PREFIXDIR := | ||
# Set to development or production | ||
ENVIRONMENT := development | ||
PORTREGISTRY := ${PWD}/port-registry.cfg | ||
SRVDIR := $(PREFIXDIR)/srv/puzzle-massive/ | ||
NGINXDIR := $(PREFIXDIR)/etc/nginx/ | ||
SYSTEMDDIR := $(PREFIXDIR)/etc/systemd/system/ | ||
DATABASEDIR := $(PREFIXDIR)/var/lib/puzzle-massive/sqlite3/ | ||
NGINXLOGDIR := $(PREFIXDIR)/var/log/nginx/puzzle-massive/ | ||
AWSTATSLOGDIR := $(PREFIXDIR)/var/log/awstats/puzzle-massive/ | ||
ARCHIVEDIR := $(PREFIXDIR)/var/lib/puzzle-massive/archive/ | ||
CACHEDIR := $(PREFIXDIR)/var/lib/puzzle-massive/cache/ | ||
|
||
# Get the version from the package.json | ||
TAG := $(shell cat package.json | python -c 'import sys, json; print json.load(sys.stdin)["version"]') | ||
|
||
# For debugging what is set in variables | ||
inspect.%: | ||
@echo $($*) | ||
|
||
ifeq ($(shell which virtualenv),) | ||
$(error run "./bin/setup.sh" to install virtualenv) | ||
endif | ||
ifeq ($(shell ls bin/activate),) | ||
$(error run "virtualenv .") | ||
endif | ||
ifneq ($(shell which pip),$(project_dir)bin/pip) | ||
$(warning run "source bin/activate" to activate the virtualenv. Using $(shell which pip). Ignore this warning if using sudo make install.) | ||
endif | ||
|
||
# Always run. Useful when target is like targetname.% . | ||
# Use $* to get the stem | ||
FORCE: | ||
|
||
objects := site.cfg web/puzzle-massive.conf stats/awstats.puzzle.massive.xyz.conf stats/awstats-puzzle-massive-crontab | ||
|
||
|
||
##### | ||
|
||
web/dhparam.pem: | ||
openssl dhparam -out $@ 2048 | ||
|
||
bin/chill: chill/requirements.txt requirements.txt | ||
pip install -r $< | ||
touch $@; | ||
|
||
objects += chill/puzzle-massive-chill.service | ||
chill/puzzle-massive-chill.service: chill/puzzle-massive-chill.service.sh | ||
./$< $(ENVIRONMENT) $(project_dir) > $@ | ||
|
||
# Create a tar of the frozen directory to prevent manually updating files within it. | ||
#objects += frozen.tar.gz | ||
frozen.tar.gz: db.dump.sql site.cfg package.json $(shell find templates/ -type f -print) $(shell find documents/ -type f -print) $(shell find queries/ -type f -print) | ||
bin/freeze.sh $@ | ||
|
||
# Also installs janitor and artist | ||
bin/puzzle-massive-api: api/requirements.txt requirements.txt api/setup.py | ||
pip install -r $< | ||
touch $@; | ||
|
||
bin/puzzle-massive-divulger: divulger/requirements.txt requirements.txt divulger/setup.py | ||
pip install -r $< | ||
touch $@; | ||
|
||
|
||
objects += api/puzzle-massive-api.service | ||
api/puzzle-massive-api.service: api/puzzle-massive-api.service.sh | ||
./$< $(ENVIRONMENT) $(project_dir) > $@ | ||
|
||
objects += api/puzzle-massive-artist.service | ||
api/puzzle-massive-artist.service: api/puzzle-massive-artist.service.sh | ||
./$< $(project_dir) > $@ | ||
|
||
objects += api/puzzle-massive-janitor.service | ||
api/puzzle-massive-janitor.service: api/puzzle-massive-janitor.service.sh | ||
./$< $(project_dir) > $@ | ||
|
||
objects += divulger/puzzle-massive-divulger.service | ||
divulger/puzzle-massive-divulger.service: divulger/puzzle-massive-divulger.service.sh | ||
./$< $(project_dir) > $@ | ||
|
||
site.cfg: site.cfg.sh $(PORTREGISTRY) | ||
./$< $(ENVIRONMENT) $(SRVDIR) $(DATABASEDIR) $(PORTREGISTRY) $(ARCHIVEDIR) $(CACHEDIR) > $@ | ||
|
||
web/puzzle-massive.conf: web/puzzle-massive.conf.sh $(PORTREGISTRY) | ||
./$< $(ENVIRONMENT) $(SRVDIR) $(NGINXLOGDIR) $(PORTREGISTRY) > $@ | ||
|
||
ifeq ($(ENVIRONMENT),production) | ||
# Only create the dhparam.pem if needed. | ||
objects += web/dhparam.pem | ||
web/puzzle-massive.conf: web/dhparam.pem | ||
endif | ||
|
||
stats/awstats.puzzle.massive.xyz.conf: stats/awstats.puzzle.massive.xyz.conf.sh | ||
./$< $(NGINXLOGDIR) > $@ | ||
|
||
stats/awstats-puzzle-massive-crontab: stats/awstats-puzzle-massive-crontab.sh | ||
./$< $(SRVDIR) $(AWSTATSLOGDIR) > $@ | ||
|
||
.PHONY: $(TAG).tar.gz | ||
$(TAG).tar.gz: bin/dist.sh | ||
./$< $@ | ||
|
||
###### | ||
|
||
.PHONY: all | ||
all: bin/chill bin/puzzle-massive-api bin/puzzle-massive-divulger $(objects) | ||
|
||
.PHONY: install | ||
install: | ||
./bin/install.sh $(SRVDIR) $(NGINXDIR) $(NGINXLOGDIR) $(AWSTATSLOGDIR) $(SYSTEMDDIR) $(DATABASEDIR) $(CACHEDIR) | ||
|
||
# Remove any created files in the src directory which were created by the | ||
# `make all` recipe. | ||
.PHONY: clean | ||
clean: | ||
rm $(objects) | ||
pip uninstall --yes -r chill/requirements.txt | ||
pip uninstall --yes -r api/requirements.txt | ||
|
||
# Remove files placed outside of src directory and uninstall app. | ||
# Will also remove the sqlite database file. | ||
.PHONY: uninstall | ||
uninstall: | ||
./bin/uninstall.sh $(SRVDIR) $(NGINXDIR) $(SYSTEMDDIR) $(DATABASEDIR) $(CACHEDIR) | ||
|
||
.PHONY: dist | ||
dist: $(TAG).tar.gz | ||
|
||
# all | ||
# create (optimize, resize) media files from source-media | ||
# install python apps using virtualenv and pip | ||
# curl the awstats source or just include it? | ||
# | ||
# development | ||
# create local server certs | ||
# recreate dist files (npm run build). dist files will be rsynced back to | ||
# local machine so they can be added in git. | ||
# update any configs to be used for the development environment | ||
# | ||
# production | ||
# run certbot certonly script (provision-certbot.sh) | ||
# install crontab for certbot | ||
# update nginx production config to uncomment certs? | ||
# | ||
# install | ||
# create sqlite database file from db.dump.sql | ||
# Only if db file is not there or has older timestamp? | ||
# requires running as sudo | ||
# install awstats and awstats.service | ||
# install watcher service for changes to nginx confs that will reload | ||
# create all directories | ||
# rsync to all directories | ||
# reload services if needed | ||
# |
Oops, something went wrong.