Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should write crossdomain.xml automatically for k8s volume. #1603

Closed
winlinvip opened this issue Feb 13, 2020 · 5 comments
Closed

Should write crossdomain.xml automatically for k8s volume. #1603

winlinvip opened this issue Feb 13, 2020 · 5 comments
Assignees
Labels
Bug It might be a bug. Enhancement Improvement or enhancement. TransByAI Translated by AI/GPT.
Milestone

Comments

@winlinvip
Copy link
Member

winlinvip commented Feb 13, 2020

Description'

Please ensure that the markdown structure is maintained.

Please describe the issue you encountered here.
'
Make sure to maintain the markdown structure.

  1. SRS version: 3.0.112

Replay

How to replay bug?

Steps to reproduce the bug

Steps to reproduce the bug:

  1. Create a shared volume in k8s for SRS and Nginx to share HLS distribution directory.
  2. When the disk is in emptyDir mode, the crossdomain.xml file cannot be found when playing HLS with Flash.
  3. Access: http://39.107.238.185/crossdomain.xml

Expected behavior:

Make sure to maintain the markdown structure.

When SRS starts the HTTP Server, if the HTTP root directory does not exist, write the default crossdomain.xml.

TRANS_BY_GPT3

@winlinvip winlinvip added Bug It might be a bug. Enhancement Improvement or enhancement. labels Feb 13, 2020
@winlinvip winlinvip added this to the SRS 3.0 release milestone Feb 13, 2020
@winlinvip
Copy link
Member Author

winlinvip commented Feb 13, 2020

crossdomain.xml can be set as default:

<cross-domain-policy>
  <allow-access-from domain="*"/>
</cross-domain-policy>

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Feb 13, 2020

index.html can be set as default: https://github.com/ossrs/srs-docker/blob/v3/index.html

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Feb 14, 2020

There is another one, console: http://localhost:1985/console

[root@ee1f99606509 srs]# ll objs/nginx/html/console/
-rw-r--r-- 1 root root   32 Dec 26 13:11 README.md
-rw-r--r-- 1 root root 3676 Dec 26 13:11 en_index.html
-rw-r--r-- 1 root root  263 Dec 26 13:11 index.html
drwxr-xr-x 6 root root 4096 Dec 26 13:52 js
-rw-r--r-- 1 root root 3711 Dec 26 13:11 ng_index.html
drwxr-xr-x 2 root root 4096 Dec 26 13:11 views

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Feb 14, 2020

A simple approach is to start another container and copy the default files of SRS to the shared volume.

For example, for Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: srs-deployment
  labels:
    app: srs
spec:
  replicas: 1
  selector:
    matchLabels:
      app: srs
  template:
    metadata:
      labels:
        app: srs
    spec:
      volumes:
      - name: cache-volume
        emptyDir: {}
      containers:
      - name: srs
        image: ossrs/srs:3
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 1935
        - containerPort: 1985
        - containerPort: 8080
        volumeMounts:
        - name: cache-volume
          mountPath: /usr/local/srs/objs/nginx/html
          readOnly: false
      - name: nginx
        image: nginx
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        volumeMounts:
        - name: cache-volume
          mountPath: /usr/share/nginx/html
          readOnly: true
      - name: srs-cp-files
        image: ossrs/srs:3
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: cache-volume
          mountPath: /tmp/html
          readOnly: false
        command: ["/bin/sh"]
        args:
        - "-c"
        - >
          if [[ ! -f /tmp/html/index.html ]]; then
            cp -R ./objs/nginx/html/* /tmp/html
          fi &&
          sleep infinity

Among them, the srs-cp-files container is responsible for copying files and then sleeping continuously.

Validation successful:

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Feb 14, 2020

Player migration completed:
http://ossrs.net/players?autostart=true

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Sep 5, 2021
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. Enhancement Improvement or enhancement. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

1 participant