careywang / myurls Goto Github PK
View Code? Open in Web Editor NEWYour Own URL Shortener
License: MIT License
Your Own URL Shortener
License: MIT License
[root@mervyn MyUrls]# docker-compose up -d
[+] Building 136.5s (7/13)
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 389B 0.0s
=> [internal] load metadata for docker.io/library/golang:1.20-alpine 15.8s
=> CACHED [build 1/6] FROM docker.io/library/golang:1.20-alpine@sha256:fd9d9d7194ec40a9a6ae89fcaef3e47c47de7746dd5848ab5343695dbbd09f8c 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 33.62kB 0.0s
=> CACHED [stage-1 1/3] WORKDIR /app 0.0s
=> ERROR [build 2/6] RUN apk update && apk add upx 120.6s
------
> [build 2/6] RUN apk update && apk add upx:
#0 0.215 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
#0 60.38 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.18/main: Permission denied
#0 60.38 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
#0 120.5 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.18/community: Permission denied
#0 120.5 4 unavailable, 0 stale; 16 distinct packages available
------
failed to solve: process "/bin/sh -c apk update && apk add upx" did not complete successfully: exit code: 4
docker版本
[root@mervyn MyUrls]# docker -v
Docker version 24.0.2, build cb74dfc
Hello,
This website https://suo.yt/ doesn't work anymore.
Is it going to be available again?
Thank you so much
@cs-star Access to XMLHttpRequest at 'https://zz01.ml/short' from origin 'https://sub.aa01.ml' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
反代未正确配置跨域
Originally posted by @CareyWang in #20 (comment)
找到原因了,sub-web短链接API后面一定要加上/short!!!!
请问MyUrls项目数据文件路径是多少?
一开始是打开https://suo.yt,可以访问首页,但是打不开短网址
我又自己建了一个,关掉CDN也是一样的
发现一些特别长的链接转换成的短链无法打开提示404,这个是什么原因
太难装了,按照教程折腾了一天也没搞定
老大能不能出个小白教程啊
我已经在.vue文件里添加了 我的域名/short 但是在前端调用的时候,还是会显示短链接获取失败,短链接单独使用是没问题的
对接怎么不能 短链接获取 不知道哪里设置了
各位,如果你们域名是托管到cf上的话,在本地配置跨域是没用的
可以去cf上的转换规则上配置
亲自踩坑!!!
有用记得回来赞我
您好Carey,
在配置了一上午这个MyUrls之后我发现还是无法运行,subweb始终报错跨域有问题,我是宝塔面板安装的redis,php也安装了redis插件,redis-cli正常运行,后端地址配置无误,所有文件使用最新master。
跨域问题我在短链接反向代理配置文件中加入了
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
始终无效,后续换了很多也持续报错,请问这个跨域该怎么配置才是正确的呢?
Status: Downloaded newer image for golang:1.20-alpine
---> 818ca3531f99
Step 2/13 : WORKDIR /app
---> Running in c44166717085
Removing intermediate container c44166717085
---> df3135846e2a
Step 3/13 : COPY main.go go.mod go.sum .
When using COPY with more than one source file, the destination must be a directory and end with a /
ERROR: Service 'myurls' failed to build
老大centos怎么安装啊
服务端返回下面的数据
{
"Code": 1,
"Message": "longUrl为空",
"LongUrl": "",
"ShortUrl": ""
}
但是请求参数中提交了longUrl,下面是日志:
[GIN] 2020/04/21 - 04:48:50 | 400 | 79.993µs | 172.17.0.1 | POST "/short?longUrl=aHR0cHM6Ly93d3cueW91dHViZS5jb20v"
请问这个怎么解决?
redis已经exec进去看过,运行正常
网页F12没有任何报错,但是获取的短链接无法打开任何界面
求解有办法么
………………没事了,白天人傻着,域名写错了……
Deploy logs:
standard_init_linux.go:219: exec user process caused: no such file or directory
Hello there!
I hope you're doing great!
I was wondering if you could provide an easier installation, so that everyone could have this link shortner.
As of now, it's too complicated to be honest.
Please let me know,
Thanks a lot!
Myurls启动成功了,但有其他问题
Carey您好~
最近我购买了树莓派4B,然后在考虑把公网服务器的服务迁移到树莓派上,这个短链服务我一直觉得很喜欢所以也想迁移过来,但是并没有ARM64的支持,所以想问一下有任何支持ARM64的计划吗?
请问使用docker部署如何更改前端页面中http://example.com/
如题,API文档界面打不开
https://myurls.mydoc.li/
个人小范围使用的 MyUrls 不需要很长的后缀,四位乃至三位长度就够了,七位实在用不上,请问需要这么修改或者有变量参数设置吗?
如题,backend现在是写死的http://example.com,那配置domain的意义是啥呢。
而且,docker hub上的镜像也没用,能跑起来,但是用不了。。因为backend写死了。
修改index.html之后,重新构建镜像出错,应该是go编译的时候有问题
Status: Downloaded newer image for golang:1.19-alpine
---> feb4bbda921c
Step 2/15 : WORKDIR /app
---> Running in 66c72d90d14b
Removing intermediate container 66c72d90d14b
---> e8edd07e9474
Step 3/15 : RUN go env -w GO111MODULE="on" && go env -w GOPROXY="https://goproxy.cn,direct"
---> Running in 245e10d4448c
Removing intermediate container 245e10d4448c
---> 0cc71ab9e924
Step 4/15 : COPY go.sum go.mod ./
---> 91c8cb9c3f17
Step 5/15 : RUN go mod tidy
---> Running in 3d6300222a0c
go: warning: "all" matched no packages
Removing intermediate container 3d6300222a0c
---> 60d212c5c04d
Step 6/15 : FROM dependencies as build
---> 60d212c5c04d
Step 7/15 : WORKDIR /app
---> Running in 8e5ec242fef2
Removing intermediate container 8e5ec242fef2
---> 401364df6317
Step 8/15 : COPY main.go ./
---> 64424ec478b5
Step 9/15 : RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o myurls main.go
---> Running in 197b4d1483b0
main.go:14:2: no required module provides package github.com/gin-gonic/gin; to add it:
go get github.com/gin-gonic/gin
main.go:15:2: no required module provides package github.com/gomodule/redigo/redis; to add it:
go get github.com/gomodule/redigo/redis
main.go:16:2: no required module provides package github.com/sirupsen/logrus; to add it:
go get github.com/sirupsen/logrus
The command '/bin/sh -c CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o myurls main.go' returned a non-zero code: 1
到这里就出错了,大佬帮忙看看。docker-compose 一样的问题
debain11
clone项目到本地,修改 public/index.html,执行 docker build 构建本地镜像运行。
执行 docker build 构建本地镜像运行。
具体需要怎么做
很长的链接缩短后无法访问
短一些链接 缩短后访问正常
和之前版本一样反代,,权限、内存空间都没问题,但还是直接返回502
服务器内curl也是502
部署方式docker-compose
这次没有修改index.html,也没有修改docker-compose
仅仅修改了env文件
MYURLS_PORT=9002
MYURLS_DOMAIN=s2.sky11111.com
MYURLS_PROTO=https
求救啊……
两天了一直没解决这个问题……快崩溃了
问题描述:
后台curl -i http://s2*/short和curl -i http://127.0.0.1/short
均会在等待十几秒后返回 短链接不存在或已过期
redis中无新的key增加
docker logs myurls会提示
[GIN] 2023/07/23 - 03:57:52 | 200 | 1.277873ms | 194.29.187.* | GET "/"
[GIN] 2023/07/23 - 03:58:14 | 200 | 30.015488771s | 194.29.187.* | POST "/short"
[GIN] 2023/07/23 - 03:58:18 | 200 | 161.564µs | 194.29.187.* | GET "/"
[GIN] 2023/07/23 - 03:58:26 | 200 | 30.003869954s | 194.29.187.* | POST "/short"
[GIN] 2023/07/23 - 03:58:51 | 200 | 30.022925521s | 194.29.187.* | POST "/short"
[GIN] 2023/07/23 - 04:05:18 | 404 | 30.029518236s | 95.214.1**.* | GET "/short"
[GIN] 2023/07/23 - 04:06:00 | 404 | 30.029486231s | 172.22.0.1 | GET "/short"
感觉哪里出了问题,myurls没能成功访问redis
补充一点,直接使用默认的docker compose也会有类似的问题……
env文件
MYURLS_PORT=9002
MYURLS_DOMAIN=*
MYURLS_TTL=180
index.html
const backend = 'https://*' 这里无论http还是https都会出现问题
docker compose
对这个配置稍微进行了修改
手动redis-cli -h 127.0.0.1 -p 9003访问redis正常
version: "3"
services:
myurls:
build: .
container_name: myurls
restart: always
env_file: .env
ports:
- "${MYURLS_PORT}:8002"
volumes:
- ./data/myurls/logs:/app/logs
depends_on:
- myurls-redis
entrypoint: ["/app/myurls", "-domain", "${MYURLS_DOMAIN}", "-conn", "myurls-redis:6379", "-passwd", "123123", "-ttl", "${MYURLS_TTL}"]
command: redis-server --requirepass fdsaf342
myurls-redis:
image: "redis:6"
container_name: myurls-redis
restart: always
volumes:
- ./data/redis:/data
expose:
- "6379"
ports:
- 9003:6379
command: redis-server --requirepass 123123
改了.env
和backend
,docker compose跑了下,报错和 #21 一样,exec format error
。能给指下解决方向不,具体实现步骤我可以查,真搞不明白再问。
按照这里教程
https://agwa5783.gitbook.io/sub-web/kuo-zhan-yi-myurls-duan-lian-fu-wu-da-jian/untitled
docker是这样的 崩溃了要
好像api规则改了?
以前的/short api现在不一样了,部署sub-web项目后获取不到了
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.