135 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			135 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| **Purpose**: A free open source IT asset/license management system.
 | |
| 
 | |
| !!! warning
 | |
|     The Snipe-IT container will attempt to launch after the MariaDB container starts, but MariaDB takes a while set itself up before it can accept connections; as a result, Snipe-IT will fail to initialize the database.  Just wait about 30 seconds after deploying the stack, then restart the Snipe-IT container to initialize the database.  You will know it worked if you see notes about data being `Migrated`.
 | |
| 
 | |
| ## Docker Configuration
 | |
| ```yaml title="docker-compose.yml"
 | |
| version: '3.7'
 | |
| 
 | |
| services:
 | |
|   snipeit:
 | |
|     image: snipe/snipe-it
 | |
|     ports:
 | |
|       - "8000:80"
 | |
|     depends_on:
 | |
|       - db
 | |
|     env_file:
 | |
|       - stack.env
 | |
|     volumes:
 | |
|       - /srv/containers/snipe-it:/var/lib/snipeit
 | |
|     networks:
 | |
|       docker_network:
 | |
|         ipv4_address: 192.168.5.50
 | |
| 
 | |
|   redis:
 | |
|     image: redis:6.2.5-buster
 | |
|     ports:
 | |
|      - "6379:6379"
 | |
|     env_file:
 | |
|       - stack.env
 | |
|     networks:
 | |
|       docker_network:
 | |
|         ipv4_address: 192.168.5.51
 | |
| 
 | |
|   db:
 | |
|     image: mariadb:10.5
 | |
|     ports:
 | |
|       - "3306:3306"
 | |
|     env_file:
 | |
|       - stack.env
 | |
|     volumes:
 | |
|       - /srv/containers/snipe-it/db:/var/lib/mysql
 | |
|     networks:
 | |
|       docker_network:
 | |
|         ipv4_address: 192.168.5.52
 | |
| 
 | |
|   mailhog:
 | |
|     image: mailhog/mailhog:v1.0.1
 | |
|     ports:
 | |
|     # - 1025:1025
 | |
|      - "8025:8025"
 | |
|     env_file:
 | |
|       - stack.env
 | |
|     networks:
 | |
|         docker_network:
 | |
|           ipv4_address: 192.168.5.53
 | |
| 
 | |
| networks:
 | |
|   docker_network:
 | |
|     external: true
 | |
| ```
 | |
| 
 | |
| ```yaml title=".env"
 | |
| APP_ENV=production
 | |
| APP_DEBUG=false
 | |
| APP_KEY=base64:SomethingSecure
 | |
| APP_URL=https://assets.bunny-lab.io
 | |
| APP_TIMEZONE='America/Denver'
 | |
| APP_LOCALE=en
 | |
| MAX_RESULTS=500
 | |
| PRIVATE_FILESYSTEM_DISK=local
 | |
| PUBLIC_FILESYSTEM_DISK=local_public
 | |
| DB_CONNECTION=mysql
 | |
| DB_HOST=db
 | |
| DB_DATABASE=snipedb
 | |
| DB_USERNAME=snipeuser
 | |
| DB_PASSWORD=SomethingSecure
 | |
| DB_PREFIX=null
 | |
| DB_DUMP_PATH='/usr/bin'
 | |
| DB_CHARSET=utf8mb4
 | |
| DB_COLLATION=utf8mb4_unicode_ci
 | |
| IMAGE_LIB=gd
 | |
| MYSQL_DATABASE=snipedb
 | |
| MYSQL_USER=snipeuser
 | |
| MYSQL_PASSWORD=SomethingSecure
 | |
| MYSQL_ROOT_PASSWORD=SomethingSecure
 | |
| REDIS_HOST=redis
 | |
| REDIS_PASSWORD=SomethingSecure
 | |
| REDIS_PORT=6379
 | |
| MAIL_DRIVER=smtp
 | |
| MAIL_HOST=mail.bunny-lab.io
 | |
| MAIL_PORT=587
 | |
| MAIL_USERNAME=assets@bunny-lab.io
 | |
| MAIL_PASSWORD=SomethingSecure
 | |
| MAIL_ENCRYPTION=starttls
 | |
| MAIL_FROM_ADDR=assets@bunny-lab.io
 | |
| MAIL_FROM_NAME='Bunny Lab Asset Management'
 | |
| MAIL_REPLYTO_ADDR=assets@bunny-lab.io
 | |
| MAIL_REPLYTO_NAME='Bunny Lab Asset Management'
 | |
| MAIL_AUTO_EMBED_METHOD='attachment'
 | |
| DATA_LOCATION=/srv/containers/snipe-it
 | |
| APP_TRUSTED_PROXIES=192.168.5.29
 | |
| ```
 | |
| 
 | |
| ## Traefik Reverse Proxy Configuration
 | |
| If the container does not run on the same host as Traefik, you will need to manually add configuration to Traefik's dynamic config file, outlined below.
 | |
| ```yaml
 | |
| http:
 | |
|   routers:
 | |
|     assets:
 | |
|       entryPoints:
 | |
|         - websecure
 | |
|       rule: Host(`assets.bunny-lab.io`)
 | |
|       service: assets
 | |
|       tls:
 | |
|         certResolver: letsencrypt
 | |
|       middlewares:
 | |
|         - assets
 | |
| 
 | |
|   middlewares:
 | |
|     assets:
 | |
|       headers:
 | |
|         customRequestHeaders:
 | |
|           X-Forwarded-Proto: https
 | |
|           X-Forwarded-Host: assets.bunny-lab.io
 | |
|         customResponseHeaders:
 | |
|           X-Custom-Header: CustomValue # Example of a static header
 | |
| 
 | |
|   services:
 | |
|     assets:
 | |
|       loadBalancer:
 | |
|         servers:
 | |
|           - url: http://192.168.5.50:80
 | |
|         passHostHeader: true
 | |
| ``` |