mirror of
				https://github.com/samply/bridgehead.git
				synced 2025-11-04 15:20:17 +01:00 
			
		
		
		
	prototype: module for beam-file
This commit is contained in:
		
							
								
								
									
										32
									
								
								modules/beam-file-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								modules/beam-file-compose.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
# NOTE: Current implementation is restricted to a bridgehead only being able to either upload or download data
 | 
			
		||||
services:
 | 
			
		||||
  beam-file-sender:
 | 
			
		||||
    image: samply/beam-file:${BEAM_FILE_TAG}
 | 
			
		||||
    container_name: bridgehead-beam-file-sender
 | 
			
		||||
    environment:
 | 
			
		||||
      - BEAM_ID=beamfile.${PROXY_ID}
 | 
			
		||||
      - BEAM_SECRET=${BEAM_FILE_SECRET}
 | 
			
		||||
      - BEAM_URL=http://beam-proxy:8081
 | 
			
		||||
      - BIND_ADDR=0.0.0.0:8085
 | 
			
		||||
      - API_KEY=${BEAM_FILE_API_KEY}
 | 
			
		||||
    # Only uncomment if your are sure what to do
 | 
			
		||||
    # ports:
 | 
			
		||||
    #   - 8085:8085
 | 
			
		||||
    profiles: ["beam-file-sender"]
 | 
			
		||||
 | 
			
		||||
  beam-file-receiver:
 | 
			
		||||
    image: samply/beam-file:${BEAM_FILE_TAG}
 | 
			
		||||
    container_name: bridgehead-beam-file-receiver
 | 
			
		||||
    environment:
 | 
			
		||||
      - BEAM_ID=beamfile.${PROXY_ID}
 | 
			
		||||
      - BEAM_SECRET=${BEAM_FILE_SECRET}
 | 
			
		||||
      - BEAM_URL=http://beam-proxy:8081
 | 
			
		||||
      - API_KEY=${BEAM_FILE_API_KEY}
 | 
			
		||||
    command: ["receive", "save", "--outdir /data"]
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /var/cache/bridgehead/beam-file/:/data
 | 
			
		||||
    profiles: ["beam-file-receiver"]
 | 
			
		||||
 | 
			
		||||
  beam-proxy:
 | 
			
		||||
    environment:
 | 
			
		||||
      APP_beamfile_KEY: ${BEAM_FILE_SECRET}
 | 
			
		||||
							
								
								
									
										18
									
								
								modules/beam-file-setup.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								modules/beam-file-setup.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
#!/bin/bash -e
 | 
			
		||||
 | 
			
		||||
function beamFileSetup() {
 | 
			
		||||
    if [ -n "ENABLE_BEAM_FILE_SENDER" ]; then
 | 
			
		||||
       echo "Starting beam file in sender mode"
 | 
			
		||||
       OVERRIDE+=" -f ./modules/beam-file-compose.yml --profile beam-file-sender"
 | 
			
		||||
       BEAM_FILE_SECRET="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
 | 
			
		||||
       # NOTE: We could make this persistent across restarts
 | 
			
		||||
       BEAM_FILE_API_KEY="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
 | 
			
		||||
       log INFO "Beam File in Sender Mode available uses ApiKey ${BEAM_FILE_API_KEY}"
 | 
			
		||||
    elif [ -n "ENABLE_BEAM_FILE_RECEIVER" ]; then
 | 
			
		||||
       echo "Starting beam file in receiver mode"
 | 
			
		||||
       OVERRIDE+=" -f ./modules/beam-file-compose.yml --profile beam-file-receiver"
 | 
			
		||||
       BEAM_FILE_SECRET="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
 | 
			
		||||
       BEAM_FILE_API_KEY="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
 | 
			
		||||
       log INFO "Beam File in Receiver Mode available uses ApiKey ${BEAM_FILE_API_KEY}"
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user