{"_path":"/api/self-hosting","_draft":false,"_partial":false,"_empty":false,"title":"Self-Hosting Lanyard","description":"Build the Docker image by cloning this repo and running:","excerpt":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"self-hosting-lanyard"},"children":[{"type":"text","value":"Self-Hosting Lanyard"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Build the Docker image by cloning this repo and running:"}]},{"type":"element","tag":"code","props":{"code":"# The latest version is already on the docker hub, you can skip this step unless you would like to run a modified version.\ndocker build -t phineas/lanyard:latest .\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"# The latest version is already on the docker hub, you can skip this step unless you would like to run a modified version.\ndocker build -t phineas/lanyard:latest .\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"If you don't already have a redis server you'll need to run one, here's the docker command to run one:"}]},{"type":"element","tag":"code","props":{"code":"docker run -d --name lanyard-redis -v docker_mount_location_on_host:/data redis\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"docker run -d --name lanyard-redis -v docker_mount_location_on_host:/data redis\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"And run Lanyard API server using:"}]},{"type":"element","tag":"code","props":{"code":"docker run --rm -it -p 4001:4001 -e REDIS_HOST=redis -e BOT_TOKEN= --link lanyard-redis:redis phineas/lanyard:latest\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"docker run --rm -it -p 4001:4001 -e REDIS_HOST=redis -e BOT_TOKEN= --link lanyard-redis:redis phineas/lanyard:latest\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You'll be able to access the API using "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"port 4001"}]},{"type":"text","value":"."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You also need to create a Discord bot and use its token above."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Create a bot here: "},{"type":"element","tag":"a","props":{"href":"https://discord.com/developers/applications","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"https://discord.com/developers/applications"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Make sure you enable"}]},{"type":"text","value":" these settings in your bot settings:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"text","value":"Privileged Gateway Intents > "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"PRESENCE INTENT"}]}]},{"type":"element","tag":"li","props":{},"children":[{"type":"text","value":"Privileged Gateway Intents > "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"SERVER MEMBERS INTENT"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"If you'd like to run Lanyard with "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"docker-compose"}]},{"type":"text","value":", here's an example:"}]},{"type":"element","tag":"code","props":{"code":"version: \"3.8\"\n\nservices:\n redis:\n image: redis\n restart: always\n container_name: lanyard_redis\n lanyard:\n image: phineas/lanyard:latest\n restart: always\n container_name: lanyard\n depends_on:\n - redis\n ports:\n - 4001:4001\n environment:\n BOT_TOKEN: \n REDIS_HOST: redis\n","language":"yaml"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"version: \"3.8\"\n\nservices:\n redis:\n image: redis\n restart: always\n container_name: lanyard_redis\n lanyard:\n image: phineas/lanyard:latest\n restart: always\n container_name: lanyard\n depends_on:\n - redis\n ports:\n - 4001:4001\n environment:\n BOT_TOKEN: \n REDIS_HOST: redis\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Note, that you're "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"hosting a http server, not https"}]},{"type":"text","value":". You'll need to use a "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"reverse proxy"}]},{"type":"text","value":" such as "},{"type":"element","tag":"a","props":{"href":"https://traefik.io/traefik/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"traefik"}]},{"type":"text","value":" if you want to secure your API endpoint."}]}]},"head":{"meta":[{"name":"og:title","property":"og:title","content":"Self-Hosting Lanyard"},{"name":"twitter:title","property":"twitter:title","content":"Self-Hosting Lanyard"},{"name":"description","property":"description","content":"Build Lanyard from source and self-host it using the Docker image."},{"name":"og:description","property":"og:description","content":"Build Lanyard from source and self-host it using the Docker image."},{"name":"twitter:description","property":"twitter:description","content":"Build Lanyard from source and self-host it using the Docker image."}]},"body":{"type":"root","children":[{"type":"element","tag":"h1","props":{"id":"self-hosting-lanyard"},"children":[{"type":"text","value":"Self-Hosting Lanyard"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Build the Docker image by cloning this repo and running:"}]},{"type":"element","tag":"code","props":{"code":"# The latest version is already on the docker hub, you can skip this step unless you would like to run a modified version.\ndocker build -t phineas/lanyard:latest .\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#7F848E"}},"children":[{"type":"text","value":"# The latest version is already on the docker hub, you can skip this step unless you would like to run a modified version."}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":"docker build -t phineas/lanyard:latest "}]},{"type":"element","tag":"span","props":{"style":{"color":"#56B6C2"}},"children":[{"type":"text","value":"."}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"If you don't already have a redis server you'll need to run one, here's the docker command to run one:"}]},{"type":"element","tag":"code","props":{"code":"docker run -d --name lanyard-redis -v docker_mount_location_on_host:/data redis\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":"docker run -d --name lanyard-redis -v docker_mount_location_on_host:/data redis"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"And run Lanyard API server using:"}]},{"type":"element","tag":"code","props":{"code":"docker run --rm -it -p 4001:4001 -e REDIS_HOST=redis -e BOT_TOKEN= --link lanyard-redis:redis phineas/lanyard:latest\n","language":"bash"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":"docker run --rm -it -p 4001:4001 -e REDIS_HOST=redis -e BOT_TOKEN= --link lanyard-redis:redis phineas/lanyard:latest"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You'll be able to access the API using "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"port 4001"}]},{"type":"text","value":"."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"You also need to create a Discord bot and use its token above."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Create a bot here: "},{"type":"element","tag":"a","props":{"href":"https://discord.com/developers/applications","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"https://discord.com/developers/applications"}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"Make sure you enable"}]},{"type":"text","value":" these settings in your bot settings:"}]},{"type":"element","tag":"ul","props":{},"children":[{"type":"element","tag":"li","props":{},"children":[{"type":"text","value":"Privileged Gateway Intents > "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"PRESENCE INTENT"}]}]},{"type":"element","tag":"li","props":{},"children":[{"type":"text","value":"Privileged Gateway Intents > "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"SERVER MEMBERS INTENT"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"If you'd like to run Lanyard with "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"docker-compose"}]},{"type":"text","value":", here's an example:"}]},{"type":"element","tag":"code","props":{"code":"version: \"3.8\"\n\nservices:\n redis:\n image: redis\n restart: always\n container_name: lanyard_redis\n lanyard:\n image: phineas/lanyard:latest\n restart: always\n container_name: lanyard\n depends_on:\n - redis\n ports:\n - 4001:4001\n environment:\n BOT_TOKEN: \n REDIS_HOST: redis\n","language":"yaml"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"version"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"\"3.8\""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"services"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":":"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"redis"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":":"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"image"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"redis"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"restart"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"always"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"container_name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"lanyard_redis"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"lanyard"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":":"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"image"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"phineas/lanyard:latest"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"restart"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"always"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"container_name"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"lanyard"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"depends_on"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":":"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" - "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"redis"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"ports"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":":"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" - "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"4001:4001"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"environment"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":":"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"BOT_TOKEN"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":""}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"style":{"color":"#E06C75"}},"children":[{"type":"text","value":"REDIS_HOST"}]},{"type":"element","tag":"span","props":{"style":{"color":"#ABB2BF"}},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"style":{"color":"#98C379"}},"children":[{"type":"text","value":"redis"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Note, that you're "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"hosting a http server, not https"}]},{"type":"text","value":". You'll need to use a "},{"type":"element","tag":"strong","props":{},"children":[{"type":"text","value":"reverse proxy"}]},{"type":"text","value":" such as "},{"type":"element","tag":"a","props":{"href":"https://traefik.io/traefik/","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"traefik"}]},{"type":"text","value":" if you want to secure your API endpoint."}]}],"toc":{"title":"","searchDepth":2,"depth":2,"links":[]}},"_type":"markdown","_id":"content:api:self-hosting.md","_source":"content","_file":"api/self-hosting.md","_extension":"md"}