Compare commits

...

19 Commits

Author SHA1 Message Date
Will Webberley
4be72056d2 Final build pipeline tweaks 2023-04-22 14:00:27 +00:00
Will Webberley
f0ab450af6 Remove quotes from env
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-04-22 13:52:23 +00:00
Will Webberley
0c56fad0b8 Add web env to buildfile
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-04-22 13:48:48 +00:00
Will Webberley
cdef84f7ca add remaining build info
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-04-22 13:31:42 +00:00
Will Webberley
37371cf298 Ensure change to correct directory
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-26 18:51:12 +00:00
Will Webberley
1646553973 Try a web component
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-26 18:49:29 +00:00
Will Webberley
7f8622f48d Update dockerfile path
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-26 18:44:19 +00:00
Will Webberley
e11a99000d Add a context
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-26 18:43:20 +00:00
Will Webberley
ccca5549ac Revert to docker buildx
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-26 18:37:27 +00:00
Will Webberley
0a1b6dc9ce Add the volume 2023-03-26 18:12:59 +00:00
Will Webberley
7a6a4c097d Update image name
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-26 18:02:28 +00:00
Will Webberley
9b97290df1 Try update commands
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-26 18:00:36 +00:00
Will Webberley
a96d961142 Try with standard docker image
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-26 15:27:37 +00:00
Will Webberley
07d7fbe1d2 Try to comment-out util copying
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-26 15:24:20 +00:00
Will Webberley
96d8ab52a1 Migrate from chalicelib
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-25 21:41:59 +00:00
Will Webberley
10c7a6b151 attempt to allow autobuild
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-25 21:36:35 +00:00
Will Webberley
64b3d11de2 Check change dir
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-25 18:43:44 +00:00
Will Webberley
cfccc4e4d5 Add to woodpecker file
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2023-03-25 18:27:44 +00:00
Will Webberley
9cb2670fb2 Add woodpecker file 2023-03-25 18:26:15 +00:00
25 changed files with 88 additions and 25 deletions

44
.woodpecker.yml Normal file
View File

@ -0,0 +1,44 @@
pipeline:
buildweb:
group: build
image: node
when:
path: "web/*"
environment:
- VITE_API_URL=https://api.treadl.com
- VITE_IMAGINARY_URL=https://images.treadl.com
- VITE_SOURCE_REPO_URL=https://git.wilw.dev/wilw/treadl
- VITE_PATREON_URL=https://www.patreon.com/treadl
- VITE_KOFI_URL=https://ko-fi.com/wilw88
- VITE_CONTACT_EMAIL=hello@treadl.com
- VITE_APP_NAME=Treadl
commands:
- cd web
- yarn install
- yarn build
buildapi:
group: build
image: woodpeckerci/plugin-docker-buildx
secrets: [docker_username, docker_password]
when:
path: "api/*"
settings:
repo: wilw/treadl-api
dockerfile: api/Dockerfile
context: api
deployweb:
image: alpine
secrets: [ LINODE_ACCESS_KEY, LINODE_SECRET_ACCESS_KEY, BUNNY_KEY ]
when:
path: "web/*"
commands:
- cd web
- apk update
- apk add s3cmd curl
- s3cmd --configure --access_key=$LINODE_ACCESS_KEY --secret_key=$LINODE_SECRET_ACCESS_KEY --host=https://eu-central-1.linodeobjects.com --host-bucket="%(bucket)s.eu-central-1.linodeobjects.com" --dump-config > /root/.s3cfg
- s3cmd -c /root/.s3cfg sync --no-mime-magic --guess-mime-type dist/* s3://treadl.com
- 'curl -X POST -H "AccessKey: $BUNNY_KEY" https://api.bunny.net/pullzone/782753/purgeCache'
branches: main

BIN
api/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -13,6 +13,7 @@ RUN poetry export --without-hashes -f requirements.txt | pip install -r /dev/std
# Add remaining files # Add remaining files
COPY app.py . COPY app.py .
COPY chalicelib/ ./chalicelib COPY api/ .
COPY util/ .
CMD ["gunicorn" , "-b", "0.0.0.0:8000", "app:app"] CMD ["gunicorn" , "-b", "0.0.0.0:8000", "app:app"]

View File

@ -1,7 +1,7 @@
import datetime, jwt, bcrypt, re, os import datetime, jwt, bcrypt, re, os
from bson.objectid import ObjectId from bson.objectid import ObjectId
from chalicelib.util import database, mail, util from util import database, mail, util
from chalicelib.api import uploads from api import uploads
jwt_secret = os.environ['JWT_SECRET'] jwt_secret = os.environ['JWT_SECRET']
MIN_PASSWORD_LENGTH = 8 MIN_PASSWORD_LENGTH = 8

View File

@ -1,6 +1,6 @@
import os, re import os, re
from chalicelib.util import database, util from util import database, util
from chalicelib.api import uploads from api import uploads
DOMAIN = os.environ.get('APP_DOMAIN') DOMAIN = os.environ.get('APP_DOMAIN')

View File

@ -1,8 +1,8 @@
import datetime, re, os import datetime, re, os
import pymongo import pymongo
from bson.objectid import ObjectId from bson.objectid import ObjectId
from chalicelib.util import database, util, mail, push from util import database, util, mail, push
from chalicelib.api import uploads from api import uploads
APP_NAME = os.environ.get('APP_NAME') APP_NAME = os.environ.get('APP_NAME')
APP_URL = os.environ.get('APP_URL') APP_URL = os.environ.get('APP_URL')

View File

@ -1,8 +1,8 @@
import re, datetime, os import re, datetime, os
import pymongo import pymongo
from bson.objectid import ObjectId from bson.objectid import ObjectId
from chalicelib.util import database, util, mail from util import database, util, mail
from chalicelib.api import uploads, groups from api import uploads, groups
APP_NAME = os.environ.get('APP_NAME') APP_NAME = os.environ.get('APP_NAME')
APP_URL = os.environ.get('APP_URL') APP_URL = os.environ.get('APP_URL')

View File

@ -1,8 +1,8 @@
import datetime, base64, os import datetime, base64, os
from bson.objectid import ObjectId from bson.objectid import ObjectId
import requests import requests
from chalicelib.util import database, wif, util, mail from util import database, wif, util, mail
from chalicelib.api import uploads from api import uploads
APP_NAME = os.environ.get('APP_NAME') APP_NAME = os.environ.get('APP_NAME')

View File

@ -1,7 +1,7 @@
import datetime, re import datetime, re
from bson.objectid import ObjectId from bson.objectid import ObjectId
from chalicelib.util import database, wif, util from util import database, wif, util
from chalicelib.api import uploads from api import uploads
default_pattern = { default_pattern = {
'warp': { 'warp': {

View File

@ -1,8 +1,8 @@
import re, datetime import re, datetime
import pymongo import pymongo
from bson.objectid import ObjectId from bson.objectid import ObjectId
from chalicelib.util import database, util, mail from util import database, util, mail
from chalicelib.api import uploads, groups from api import uploads, groups
def get_users(user): def get_users(user):
db = database.get_db() db = database.get_db()

View File

@ -1,7 +1,7 @@
import re, random import re, random
import pymongo import pymongo
from chalicelib.util import database, util from util import database, util
from chalicelib.api import uploads from api import uploads
def all(user, params): def all(user, params):
if not params or 'query' not in params: raise util.errors.BadRequest('Username parameter needed') if not params or 'query' not in params: raise util.errors.BadRequest('Username parameter needed')

View File

@ -4,7 +4,7 @@ from bson.objectid import ObjectId
import boto3 import boto3
from botocore.client import Config from botocore.client import Config
import blurhash import blurhash
from chalicelib.util import database from util import database
def sanitise_filename(s): def sanitise_filename(s):
bad_chars = re.compile('[^a-zA-Z0-9_.]') bad_chars = re.compile('[^a-zA-Z0-9_.]')

View File

@ -1,7 +1,7 @@
import datetime import datetime
from bson.objectid import ObjectId from bson.objectid import ObjectId
from chalicelib.util import database, util from util import database, util
from chalicelib.api import uploads from api import uploads
def me(user): def me(user):
return { return {

View File

@ -5,8 +5,8 @@ from flask_cors import CORS
import werkzeug import werkzeug
import sentry_sdk import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration from sentry_sdk.integrations.flask import FlaskIntegration
from chalicelib.util import util from util import util
from chalicelib.api import accounts, users, projects, objects, uploads, groups, search, invitations, root, activitypub from api import accounts, users, projects, objects, uploads, groups, search, invitations, root, activitypub
app = Flask(__name__) app = Flask(__name__)
CORS(app) CORS(app)

View File

@ -6,7 +6,7 @@ export MAILGUN_KEY=""
export MONGO_URL="mongodb://localhost" export MONGO_URL="mongodb://localhost"
export MONGO_DATABASE="treadl" export MONGO_DATABASE="treadl"
export JWT_SECRET="devsecret" export JWT_SECRET="devsecret"
export GOOGLE_APPLICATION_CREDENTIALS="chalicelib/firebase.json" export GOOGLE_APPLICATION_CREDENTIALS="firebase.json"
export AWS_S3_ENDPOINT="https://eu-central-1.linodeobjects.com/" export AWS_S3_ENDPOINT="https://eu-central-1.linodeobjects.com/"
export AWS_S3_BUCKET="treadl" export AWS_S3_BUCKET="treadl"
export AWS_ACCESS_KEY_ID="" export AWS_ACCESS_KEY_ID=""

View File

@ -5,8 +5,8 @@ from flask_limiter.util import get_remote_address
from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives.asymmetric import rsa
from bson.objectid import ObjectId from bson.objectid import ObjectId
from chalicelib.api import accounts from api import accounts
from chalicelib.util import util from util import util
errors = werkzeug.exceptions errors = werkzeug.exceptions

18
web/bucket-policy.json Normal file
View File

@ -0,0 +1,18 @@
{
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"*"
]
},
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3::treadl.com/*"
]
}
]
}