Social media image generator
docker run -d -p 80:80 ghcr.io/yznts/oxigen:latest
Oxigen is a dynamic social media image generator, which gives you an ability to easily create, customize and use og images with both UI and API.
Social media image generator
Home Page: https://oxigen.kyoto.codes
❯ docker run ghcr.io/yuriizinets/oxigen:latest -p 9001:8000
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "-p": executable file not found in $PATH: unknown.
ERRO[0001] error waiting for container:
I managed to resolve this by swapping the order around, and noticed there is a pull request which has this fix ready as well. Thanks @mre
After running the docker image, it seems to not load the web ui. Logs say it's ready at port 8000. No other warnings or anything. Any ideas?
EDIT: I figured it out. The container calls for port 8000 so the ports should be
80:8000 not 80:80 as shown in the readme :)
EDIT2: Yeah, the Docker image needs work. Tried it in a few browsers and it's not loading any images. Even with the default values.
❯ docker run ghcr.io/yuriizinets/oxigen:latest -p 9001:8000
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "-p": executable file not found in $PATH: unknown.
ERRO[0001] error waiting for container:
I managed to resolve this by swapping the order around, and noticed there is a pull request which has this fix ready as well. Thanks @mre
Handle errors and give reasonable response, for both API and UI
After we got control over the size of the image, there was a problem with the size of the logo. If we want to get a smaller output image, then the logo takes up almost the entire space, for example:
Image width: 600;
Image height: 300;
And vice versa, if you set the dimensions larger, the logo comes out too small:
Image width: 2400;
Image height: 1200;
As a suggestion, either add control over the size of the logo as well, or at least calculate its size as a percentage
While running oxigen binary (not as docker container), there is an error related to fonts loading (originally reported here).
Serving on ::8000
172.17.0.1 - - [13/Jan/2023:17:21:17 +0000] "GET / HTTP/1.1" 200 15410
172.17.0.1 - - [13/Jan/2023:17:21:17 +0000] "GET /assets/css/tailwind.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:17 +0000] "GET /assets/css/bundle.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:17 +0000] "GET /assets/js/bundle.min.js HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:20 +0000] "GET /ui?title=Oxigen%3A+Social+media+image+generator&author=%40yuriizinets&website=github.com%2Fyuriizinets%2Foxigen&logo=https%3A%2F%2Fimgur.com%2FkKUt9Pt.png&background=https%3A%2F%2Fimgur.com%2F8K6rdoZ.png&dim=110 HTTP/1.1" 200 15264
172.17.0.1 - - [13/Jan/2023:17:21:20 +0000] "GET /assets/css/bundle.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:20 +0000] "GET /assets/css/tailwind.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:20 +0000] "GET /assets/js/bundle.min.js HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:21 +0000] "GET /ui?title=Oxigen%3A+Social+media+image+generator&author=%40yuriizinets&website=github.com%2Fyuriizinets%2Foxigen&logo=https%3A%2F%2Fimgur.com%2FkKUt9Pt.png&background=https%3A%2F%2Fimgur.com%2F8K6rdoZ.png&dim=110 HTTP/1.1" 200 15264
172.17.0.1 - - [13/Jan/2023:17:21:21 +0000] "GET /assets/css/tailwind.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:21 +0000] "GET /assets/css/bundle.min.css HTTP/1.1" 200 0
172.17.0.1 - - [13/Jan/2023:17:21:21 +0000] "GET /assets/js/bundle.min.js HTTP/1.1" 200 0
2023/01/13 17:21:26 http: panic serving 172.17.0.1:57316: error while reading font file
goroutine 70 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
/usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc00022a2d0}, 0xc000204c00)
/src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc00022a2d0?}, 0x0?)
/usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc0002161c0}, 0xc000204c00)
/go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc0002161c0}, 0xc00039c900)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc000385e60?}, {0xc7b858, 0xc0002161c0}, 0xc00039c900)
/usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0003bc1e0, {0xc7c440, 0xc00007f8c0})
/usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:28 http: panic serving 172.17.0.1:57306: error while reading font file
goroutine 15 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
/usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc00022a500}, 0xc000176400)
/src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc00022a500?}, 0x0?)
/usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc000216380}, 0xc000176400)
/go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc000216380}, 0xc000205600)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc0001ac7b0?}, {0xc7b858, 0xc000216380}, 0xc000205600)
/usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0001aa140, {0xc7c440, 0xc00007f8c0})
/usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:31 http: panic serving 172.17.0.1:57292: error while reading font file
goroutine 6 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
/usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc0000261e0}, 0xc000204200)
/src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc0000261e0?}, 0x0?)
/usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc000216000}, 0xc000204200)
/go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc000216000}, 0xc000205100)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc00007f9b0?}, {0xc7b858, 0xc000216000}, 0xc000205100)
/usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc000001e00, {0xc7c440, 0xc00007f8c0})
/usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:34 http: panic serving 172.17.0.1:57298: error while reading font file
goroutine 14 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
/usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc00022a2d0}, 0xc000204400)
/src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc00022a2d0?}, 0x0?)
/usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc0002160e0}, 0xc000204400)
/go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc0002160e0}, 0xc000205700)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc0001ac6c0?}, {0xc7b858, 0xc0002160e0}, 0xc000205700)
/usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0001aa0a0, {0xc7c440, 0xc00007f8c0})
/usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:36 http: panic serving 172.17.0.1:57318: error while reading font file
goroutine 55 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
/usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc0000262d0}, 0xc000176300)
/src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc0000262d0?}, 0x0?)
/usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc000216000}, 0xc000176300)
/go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc000216000}, 0xc000176100)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc0001ad320?}, {0xc7b858, 0xc000216000}, 0xc000176100)
/usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0003bc5a0, {0xc7c440, 0xc00007f8c0})
/usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3102 +0x4db
2023/01/13 17:21:38 http: panic serving 172.17.0.1:38978: error while reading font file
goroutine 160 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x846680, 0xc76cd0})
/usr/local/go/src/runtime/panic.go:890 +0x262
main.AGenerate({0xc7beb8, 0xc00022a280}, 0xc000282200)
/src/api.generate.go:110 +0x11a5
net/http.HandlerFunc.ServeHTTP(0xc7b858?, {0xc7beb8?, 0xc00022a280?}, 0x0?)
/usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78b40, 0xc000014070}, {0xc795a0, 0xbfd190}, 0xbfcee0}, {0xc7b858, 0xc0002160e0}, 0xc000282200)
/go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00016a0c0, {0xc7b858, 0xc0002160e0}, 0xc000176200)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc0001ac0c0?}, {0xc7b858, 0xc0002160e0}, 0xc000176200)
/usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0001aa0a0, {0xc7c440, 0xc00007f8c0})
/usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3102 +0x4db
I just tried the tool from the docker container and used an SVG as image (which seems to not be supported). The app then paniced unrecoverably.
I suggest not panic-ing in a web service and add proper error handling instead.
2023/01/14 17:48:41 http: panic serving 172.17.0.1:56382: image: unknown format
goroutine 463 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0x85cb80, 0xc000112e00})
/usr/local/go/src/runtime/panic.go:890 +0x262
git.sr.ht/~kyoto-framework/zen.Must[...]({0x0?, 0x0?}, {0xc78280?, 0xc000112e00?})
/go/pkg/mod/git.sr.ht/~kyoto-framework/[email protected]/errors.go:7 +0x4e
main.AGenerate({0xc7bf58, 0xc000142280}, 0xc0000f0200)
/src/api.generate.go:165 +0xeb5
net/http.HandlerFunc.ServeHTTP(0xc7b8f8?, {0xc7bf58?, 0xc000142280?}, 0x0?)
/usr/local/go/src/net/http/server.go:2109 +0x2f
github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xc78be0, 0xc000110060}, {0xc79640, 0xbfd230}, 0xbfcf80}, {0xc7b8f8, 0xc000284000}, 0xc0000f0200)
/go/pkg/mod/github.com/gorilla/[email protected]/logging.go:47 +0xef
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00018c0c0, {0xc7b8f8, 0xc000284000}, 0xc0000f0000)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1cf
net/http.serverHandler.ServeHTTP({0xc00078a2d0?}, {0xc7b8f8, 0xc000284000}, 0xc0000f0000)
/usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0000f60a0, {0xc7c4e0, 0xc000115980})
/usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3102 +0x4db
Cleanup temp files on processing finish
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.