diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..03bd412 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.env diff --git a/LICENSE b/LICENSE index 2770930..5323da4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 dopos +Copyright (c) 2023 Alexey Kovrizhkin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ab2ebcb --- /dev/null +++ b/Makefile @@ -0,0 +1,70 @@ +# app custom Makefile + +# Docker repo & image name without version +IMAGE ?= superseriousbusiness/gotosocial +# Hostname for external access +APP_SITE ?= fedi.dev.lan +# App names (db/user name etc) +APP_NAME ?= gts + +# PgSQL used as DB +USE_DB = yes + +# Sample admin user data +ADD_USER = yes + +# ------------------------------------------------------------------------------ +# app custom config + +IMAGE_VER ?= latest + +DCAPE_ROOT ?= /opt/dcape/var + +DATA_PATH ?= $(APP_NAME) + +DCAPE_GTS_UID ?= 1000 +DCAPE_GTS_GID ?= 1000 + +CONTAINER_ID ?= $(APP_TAG)_app_1 + +# ------------------------------------------------------------------------------ +# .env template (custom part) +# inserted in .env.sample via 'make config' +define CONFIG_CUSTOM +# ------------------------------------------------------------------------------ +# app custom config, generated by make config +# db:$(USE_DB) user:$(ADD_USER) + +# Path to /opt/dcape/var. Used only outside drone +DCAPE_ROOT=$(DCAPE_ROOT) + +DATA_PATH=$(DATA_PATH) + +endef + +# ------------------------------------------------------------------------------ +# Find and include DCAPE/apps/drone/dcape-app/Makefile +DCAPE_COMPOSE ?= dcape-compose +DCAPE_MAKEFILE ?= $(shell docker inspect -f "{{.Config.Labels.dcape_app_makefile}}" $(DCAPE_COMPOSE)) +ifeq ($(shell test -e $(DCAPE_MAKEFILE) && echo -n yes),yes) + include $(DCAPE_MAKEFILE) +else + include /opt/dcape-app/Makefile +endif + + +## create user +user-add: + @docker exec -it $(CONTAINER_ID) /gotosocial/gotosocial admin account create \ + --username $(USER_NAME) \ + --email $(USER_EMAIL) \ + --password '$(USER_PASS)' + +## promote user to admin +user-admin: + @docker exec -it $(CONTAINER_ID) /gotosocial/gotosocial admin account promote --username $(USER_NAME) + +## create file storage with perms +storage: + @path=$(DCAPE_ROOT)/$(DATA_PATH) ; \ + [ -d $$path ] || sudo install -o $(DCAPE_GTS_UID) -g $(DCAPE_GTS_GID) -d $$path diff --git a/README.md b/README.md index 5eaa7e9..b03f81a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,38 @@ -# dcape-app-gotosocial -GoToSocial application package for dcape +# dcape-app-GoToSocial + +[![GitHub Release][1]][2] [![GitHub code size in bytes][3]]() [![GitHub license][4]][5] + +[1]: https://img.shields.io/github/release/dopos/dcape-app-gotosocial.svg +[2]: https://github.com/dopos/dcape-app-gotosocial/releases +[3]: https://img.shields.io/github/languages/code-size/dopos/dcape-app-gotosocial.svg +[4]: https://img.shields.io/github/license/dopos/dcape-app-gotosocial.svg +[5]: LICENSE + +[GoToSocial](https://gotosocial.org/) application package for [dcape](https://github.com/dopos/dcape). + +## Docker image used + +* [gotosocial/gotosocial](https://hub.docker.com/r/superseriousbusiness/gotosocial/) + +## Requirements + +* linux 64bit (git, make, wget, gawk, openssl) +* [docker](http://docker.io) +* [dcape](https://github.com/dopos/dcape) +* Git service ([github](https://github.com), [gitea](https://gitea.io) or [gogs](https://gogs.io)) + +## Usage + +* Fork this repo in your Git service +* Setup deploy hook +* Run "Test delivery" (config sample will be created in dcape) +* Edit and save config (enable deploy etc) +* Run "Test delivery" again (app will be installed and started on webhook host) + +See also: [Deploy setup](https://github.com/dopos/dcape/blob/master/DEPLOY.md) (in Russian) + +## License + +The MIT License (MIT), see [LICENSE](LICENSE). + +Copyright (c) 2023 Alexey Kovrizhkin diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f827114 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +# custom app config +# overrides DCAPE/apps/drone/dcape-app/docker-compose.yml + +version: '2' + +services: + app: + labels: + - traefik.http.services.${APP_TAG}.loadbalancer.server.port=8080 + environment: + - GTS_HOST=${APP_SITE} + - GTS_DB_TYPE=postgres + - GTS_DB_ADDRESS=db + - GTS_DB_DATABASE=${PGDATABASE} + - GTS_DB_USER=${PGUSER} + - GTS_DB_PASSWORD=${PGPASSWORD} + - GTS_DB_TLS_MODE=false + - GTS_LETSENCRYPT_ENABLED=false + - GTS_PROTOCOL=http + ## For reverse proxy setups: + # GTS_TRUSTED_PROXIES: "172.x.x.x" + volumes: + - ${DCAPE_ROOT}/${DATA_PATH}:/gotosocial/storage +