|
| 1 | +--- |
| 2 | +description: How to configure Lavalink with the Config Server |
| 3 | +--- |
| 4 | + |
| 5 | +# Config Server |
| 6 | + |
| 7 | +## Example Lavalink application.yml |
| 8 | + |
| 9 | +To configure Lavalink to pull it's configuration from a [Lavalink Config Server](https://github.com/lavalink-devs/Lavalink-Config-Server) you need to put the following in your `application.yml` file: |
| 10 | + |
| 11 | +```yaml title="application.yml" |
| 12 | +--8<-- "LavalinkServer/application.yml.cloud-example" |
| 13 | +``` |
| 14 | + |
| 15 | +Alternatively, this can also be done via environment variables: |
| 16 | + |
| 17 | +<details markdown="1"> |
| 18 | +<summary>Environment Variables</summary> |
| 19 | + |
| 20 | +```bash |
| 21 | +SPRING_APPLICATION_NAME |
| 22 | +SPRING_CLOUD_CONFIG_PROFILE |
| 23 | +SPRING_CLOUD_CONFIG_LABEL |
| 24 | +SPRING_CLOUD_CONFIG_FAIL_FAST |
| 25 | + |
| 26 | +SPRING_CONFIG_IMPORT |
| 27 | +``` |
| 28 | + |
| 29 | +</details> |
| 30 | + |
| 31 | +## Running the Lavalink Config Server |
| 32 | + |
| 33 | +To run the Lavalink Config Server, you can use the docker image located at [`ghcr.io/lavalink-devs/lavalink-config-server`](https://github.com/lavalink-devs/Lavalink-Config-Server/pkgs/container/lavalink-config-server) |
| 34 | + |
| 35 | +### Example docker-compose.yml |
| 36 | + |
| 37 | +```yaml |
| 38 | +services: |
| 39 | + lavalink-config-server: |
| 40 | + image: ghcr.io/lavalink-devs/lavalink-config-server:master |
| 41 | + container_name: lavalink-config-server |
| 42 | + restart: unless-stopped |
| 43 | + environment: |
| 44 | + # set the environment variables for the config server here |
| 45 | + volumes: |
| 46 | + # mount application.yml from the same directory, if you want to use environment variables remove this line below |
| 47 | + - ./application.yml:/opt/Lavalink-Config-Server/application.yml |
| 48 | + networks: |
| 49 | + - lavalink |
| 50 | + expose: |
| 51 | + # lavalink Config Server exposes port 8888 to pull config from |
| 52 | + - 8888 |
| 53 | + ports: |
| 54 | + # you only need this if you want to make your Lavalink Config Server accessible from outside of containers, keep in mind this will expose your lavalink Config Server to the internet |
| 55 | + - "8888:8888" |
| 56 | + # if you want to restrict access to localhost only |
| 57 | + # - "127.0.0.1:8888:8888" |
| 58 | +networks: |
| 59 | + # create a lavalink network you can add other containers to, to give them access to Lavalink |
| 60 | + lavalink: |
| 61 | + name: lavalink |
| 62 | +``` |
| 63 | +
|
| 64 | +### Example application.yml |
| 65 | +
|
| 66 | +The Lavalink Config Server can be configured to use a git repository or a local filesystem as the backend for the configuration files. |
| 67 | +
|
| 68 | +```yaml title="application.yml" |
| 69 | +spring: |
| 70 | + profiles: |
| 71 | + # Set to native to use a local filesystem/static url |
| 72 | + active: git |
| 73 | + cloud: |
| 74 | + config: |
| 75 | + server: |
| 76 | + # Set to true to allow empty config files to be accepted |
| 77 | + accept-empty: false |
| 78 | + # See: https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#_git_backend |
| 79 | + git: |
| 80 | + # The uri supports the following placeholders: {application}, {profile} & {label} |
| 81 | + uri: "https://github.com/lavalink-devs/Lavalink-Example-Configs" |
| 82 | + # set this to {application} if you group your configs by application |
| 83 | + search-paths: "{application}" |
| 84 | + skipSslValidation: false |
| 85 | + timeout: 5 |
| 86 | + cloneOnStart: true |
| 87 | + force-pull: false |
| 88 | + deleteUntrackedBranches: false |
| 89 | + refreshRate: 0 |
| 90 | + # username: trolley |
| 91 | + # for GitHub, use a personal access token |
| 92 | + # password: strongpassword |
| 93 | + defaultLabel: main |
| 94 | + # See: https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#_file_system_backend |
| 95 | + native: |
| 96 | + # when using the native backend, the searchLocations supports the following placeholders: {application}, {profile} & {label} |
| 97 | + # make sure to tell the lavalink config server a specific config location via spring.config.location=application.yml |
| 98 | + # or else it will try to load its own config from any subdirectory your lavalink server configs might be in |
| 99 | + searchLocations: "file:config/{application}" |
| 100 | + |
| 101 | +server: |
| 102 | + port: 8888 |
| 103 | + address: 127.0.0.1 |
| 104 | + |
| 105 | +logging: |
| 106 | + level: |
| 107 | + root: INFO |
| 108 | + org.springframework.cloud.config: DEBUG |
| 109 | +``` |
| 110 | +
|
| 111 | +Alternatively, this can also be done via environment variables: |
| 112 | +
|
| 113 | +<details markdown="1"> |
| 114 | +<summary>Environment Variables</summary> |
| 115 | +
|
| 116 | +```bash |
| 117 | +SPRING_PROFILES_ACTIVE |
| 118 | + |
| 119 | +SPRING_CLOUD_CONFIG_SERVER_ACCEPT_EMPTY |
| 120 | + |
| 121 | +SPRING_CLOUD_CONFIG_SERVER_GIT_URI |
| 122 | +SPRING_CLOUD_CONFIG_SERVER_GIT_SEARCH_PATHS |
| 123 | +SPRING_CLOUD_CONFIG_SERVER_GIT_SKIP_SSL_VALIDATION |
| 124 | +SPRING_CLOUD_CONFIG_SERVER_GIT_TIMEOUT |
| 125 | +SPRING_CLOUD_CONFIG_SERVER_GIT_CLONE_ON_START |
| 126 | +SPRING_CLOUD_CONFIG_SERVER_GIT_FORCE_PULL |
| 127 | +SPRING_CLOUD_CONFIG_SERVER_GIT_DELETE_UNTRACKED_BRANCHES |
| 128 | +SPRING_CLOUD_CONFIG_SERVER_GIT_REFRESH_RATE |
| 129 | +SPRING_CLOUD_CONFIG_SERVER_GIT_USERNAME |
| 130 | +SPRING_CLOUD_CONFIG_SERVER_GIT_PASSWORD |
| 131 | +SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT_LABEL |
| 132 | + |
| 133 | +SPRING_CLOUD_CONFIG_SERVER_NATIVE_SEARCH_LOCATIONS |
| 134 | + |
| 135 | +SERVER_PORT |
| 136 | +SERVER_ADDRESS |
| 137 | + |
| 138 | +LOGGING_LEVEL_ROOT |
| 139 | +LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_CLOUD_CONFIG |
| 140 | +``` |
| 141 | + |
| 142 | +</details> |
| 143 | + |
| 144 | +### Example config repository |
| 145 | + |
| 146 | +See [Lavalink Example Configs](https://github.com/lavalink-devs/Lavalink-Example-Configs) for an example config repository. |
| 147 | + |
| 148 | +#### Structure |
| 149 | + |
| 150 | +The config repository should have the following structure: |
| 151 | + |
| 152 | +```text |
| 153 | +. |
| 154 | +├── lavalink |
| 155 | +│ ├── application.yml |
| 156 | +│ └── application-{profile}.yml |
| 157 | +``` |
| 158 | + |
| 159 | +The `application.yml` file is the default configuration file. |
| 160 | +The `application-{profile}.yml` file is the configuration file for the specified profile and overrides the config entries in the default configuration file. |
| 161 | +The profile name can be set in the [`application.yml`](#example-applicationyml) file of the Lavalink server. |
0 commit comments