Merge branch 'master' into 'master'
Update Dockerfile and docker-compose See merge request famedly/conduit!39
This commit is contained in:
		
						commit
						7e4dc65747
					
				
					 5 changed files with 62 additions and 42 deletions
				
			
		|  | @ -30,7 +30,7 @@ COPY . . | ||||||
| RUN if [[ $LOCAL == "true" ]]; then \ | RUN if [[ $LOCAL == "true" ]]; then \ | ||||||
|         cargo install --path . ; \ |         cargo install --path . ; \ | ||||||
|     else \ |     else \ | ||||||
|         cargo install --git "https://github.com/timokoesters/conduit.git" --rev ${GIT_REF}; \ |         cargo install --git "https://gitlab.com/famedly/conduit.git" --rev ${GIT_REF}; \ | ||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
| ########################## RUNTIME IMAGE ########################## | ########################## RUNTIME IMAGE ########################## | ||||||
|  | @ -40,7 +40,9 @@ FROM alpine:3.12 | ||||||
| 
 | 
 | ||||||
| ARG CREATED | ARG CREATED | ||||||
| ARG VERSION | ARG VERSION | ||||||
| ARG GIT_REF=HEAD | ARG GIT_REF=origin/master | ||||||
|  | 
 | ||||||
|  | ENV CONDUIT_CONFIG="/srv/conduit/conduit.toml" | ||||||
| 
 | 
 | ||||||
| # Labels according to https://github.com/opencontainers/image-spec/blob/master/annotations.md | # Labels according to https://github.com/opencontainers/image-spec/blob/master/annotations.md | ||||||
| # including a custom label specifying the build command | # including a custom label specifying the build command | ||||||
|  | @ -52,7 +54,7 @@ LABEL org.opencontainers.image.created=${CREATED} \ | ||||||
|       org.opencontainers.image.description="A Matrix homeserver written in Rust" \ |       org.opencontainers.image.description="A Matrix homeserver written in Rust" \ | ||||||
|       org.opencontainers.image.url="https://conduit.rs/" \ |       org.opencontainers.image.url="https://conduit.rs/" \ | ||||||
|       org.opencontainers.image.revision=${GIT_REF} \ |       org.opencontainers.image.revision=${GIT_REF} \ | ||||||
|       org.opencontainers.image.source="https://git.koesters.xyz/timo/conduit.git" \ |       org.opencontainers.image.source="https://gitlab.com/famedly/conduit.git" \ | ||||||
|       org.opencontainers.image.licenses="Apache-2.0" \ |       org.opencontainers.image.licenses="Apache-2.0" \ | ||||||
|       org.opencontainers.image.documentation="" \ |       org.opencontainers.image.documentation="" \ | ||||||
|       org.opencontainers.image.ref.name="" \ |       org.opencontainers.image.ref.name="" \ | ||||||
|  |  | ||||||
|  | @ -82,9 +82,12 @@ Pull and run the docker image with | ||||||
| 
 | 
 | ||||||
| ``` bash | ``` bash | ||||||
| docker pull matrixconduit/matrix-conduit:latest | docker pull matrixconduit/matrix-conduit:latest | ||||||
| docker run -d -p 8448:8000 -v db:/srv/conduit/.local/share/conduit matrixconduit/matrix-conduit:latest | docker run -d -p 8448:8000 -v ~/conduit.toml:/srv/conduit/conduit.toml -v db:/srv/conduit/.local/share/conduit matrixconduit/matrix-conduit:latest | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | > <b>Note:</b> You also need to supply a `conduit.toml` config file, you can find an example [here](./conduit-example.toml). | ||||||
|  | > Or you can pass in `-e CONDUIT_CONFIG=""` and configure Conduit purely with env vars. | ||||||
|  | 
 | ||||||
| Or build and run it with docker or docker-compose. [Read more](docker/README.md) | Or build and run it with docker or docker-compose. [Read more](docker/README.md) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5,43 +5,49 @@ services: | ||||||
|     homeserver: |     homeserver: | ||||||
|         ### If you already built the Conduit image with 'docker build' or want to use the Docker Hub image, |         ### If you already built the Conduit image with 'docker build' or want to use the Docker Hub image, | ||||||
|         ### then you are ready to go. |         ### then you are ready to go. | ||||||
|         image: matrixconduit/matrix-conduit:latest |         #image: matrixconduit/matrix-conduit:latest | ||||||
|         ### If you want to build a fresh image from the sources, then comment the image line and uncomment the |         ### If you want to build a fresh image from the sources, then comment the image line and uncomment the | ||||||
|         ### build lines. If you want meaningful labels in your built Conduit image, you should run docker-compose like this: |         ### build lines. If you want meaningful labels in your built Conduit image, you should run docker-compose like this: | ||||||
|         ### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d |         ### CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VERSION=$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml) docker-compose up -d | ||||||
|         # build: |         build: | ||||||
|         #     context: . |             context: . | ||||||
|         #     args: |             args: | ||||||
|         #         CREATED: |                 CREATED: '2021-03-16T08:18:27Z' | ||||||
|         #         VERSION: |                 VERSION: '0.1.0' | ||||||
|         #         LOCAL: 'false' |                 LOCAL: 'false' | ||||||
|         #         GIT_REF: HEAD |                 GIT_REF: origin/master | ||||||
|         restart: unless-stopped |         restart: unless-stopped | ||||||
|         ports: |         ports: | ||||||
|             - 8448:8000 |             - 8448:8000 | ||||||
|         volumes: |         volumes: | ||||||
|             - db:/srv/conduit/.local/share/conduit |             - db:/srv/conduit/.local/share/conduit | ||||||
|             ### Uncomment if you want to use Rocket.toml to configure Conduit |             ### Uncomment if you want to use conduit.toml to configure Conduit | ||||||
|             ### Note: Set env vars will override Rocket.toml values |             ### Note: Set env vars will override conduit.toml values | ||||||
|             # - ./Rocket.toml:/srv/conduit/Rocket.toml |             # - ./conduit.toml:/srv/conduit/conduit.toml | ||||||
|         environment: |         environment: | ||||||
|             ROCKET_SERVER_NAME: localhost:8000  # replace with your own name |             CONDUIT_SERVER_NAME: localhost:8000  # replace with your own name | ||||||
|  |             CONDUIT_TRUSTED_SERVERS: | ||||||
|  |                 - 'matrix.org' | ||||||
|             ### Uncomment and change values as desired |             ### Uncomment and change values as desired | ||||||
|             # ROCKET_LOG: normal  # Available levels are: off, debug, normal, critical |             # CONDUIT_ADDRESS: 127.0.0.1 | ||||||
|             # ROCKET_PORT: 8000 |             # CONDUIT_PORT: 8000 | ||||||
|             # ROCKET_REGISTRATION_DISABLED: 'true' |             # CONDUIT_CONFIG: '/srv/conduit/conduit.toml'  # if you want to configure purely by env vars, set this to an empty string '' | ||||||
|             # ROCKET_ENCRYPTION_DISABLED: 'true' |             # Available levels are: error, warn, info, debug, trace - more info at: https://docs.rs/env_logger/*/env_logger/#enabling-logging | ||||||
|             # ROCKET_FEDERATION_ENABLED: 'true' |             # CONDUIT_LOG: info  # default is: "info,rocket=off,_=off,sled=off" | ||||||
|             # ROCKET_DATABASE_PATH: /srv/conduit/.local/share/conduit |             # CONDUIT_ALLOW_JAEGER: 'false' | ||||||
|             # ROCKET_WORKERS: 10 |             # CONDUIT_ALLOW_REGISTRATION : 'false' | ||||||
|             # ROCKET_MAX_REQUEST_SIZE: 20_000_000  # in bytes, ~20 MB |             # CONDUIT_ALLOW_ENCRYPTION: 'false' | ||||||
|  |             # CONDUIT_ALLOW_FEDERATION: 'false' | ||||||
|  |             # CONDUIT_DATABASE_PATH: /srv/conduit/.local/share/conduit | ||||||
|  |             # CONDUIT_WORKERS: 10 | ||||||
|  |             # CONDUIT_MAX_REQUEST_SIZE: 20_000_000  # in bytes, ~20 MB | ||||||
| 
 | 
 | ||||||
|     ### Uncomment if you want to use your own Element-Web App. |     ### Uncomment if you want to use your own Element-Web App. | ||||||
|     ### Note: You need to provide a config.json for Element and you also need a second |     ### Note: You need to provide a config.json for Element and you also need a second | ||||||
|     ###       Domain or Subdomain for the communication between Element and Conduit |     ###       Domain or Subdomain for the communication between Element and Conduit | ||||||
|     ### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md |     ### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md | ||||||
|     # element-web: |     # element-web: | ||||||
|     #     image: vectorim/riot-web:latest |     #     image: vectorim/element-web:latest | ||||||
|     #     restart: unless-stopped |     #     restart: unless-stopped | ||||||
|     #     ports: |     #     ports: | ||||||
|     #         - 8009:80 |     #         - 8009:80 | ||||||
|  |  | ||||||
|  | @ -17,13 +17,13 @@ The Dockerfile includes a few build arguments that should be supplied when build | ||||||
| ARG LOCAL=false | ARG LOCAL=false | ||||||
| ARG CREATED | ARG CREATED | ||||||
| ARG VERSION | ARG VERSION | ||||||
| ARG GIT_REF=HEAD | ARG GIT_REF=origin/master | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| - **CREATED:** Date and time as string (date-time as defined by RFC 3339). Will be used to create the Open Container Initiative compliant label `org.opencontainers.image.created`. Supply by it like this `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` | - **CREATED:** Date and time as string (date-time as defined by RFC 3339). Will be used to create the Open Container Initiative compliant label `org.opencontainers.image.created`. Supply by it like this `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` | ||||||
| - **VERSION:** The SemVer version of Conduit, which is in the image. Will be used to create the Open Container Initiative compliant label `org.opencontainers.image.version`. If you have a `Cargo.toml` in your build context, you can get it with `$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)` | - **VERSION:** The SemVer version of Conduit, which is in the image. Will be used to create the Open Container Initiative compliant label `org.opencontainers.image.version`. If you have a `Cargo.toml` in your build context, you can get it with `$(grep -m1 -o '[0-9].[0-9].[0-9]' Cargo.toml)` | ||||||
| - **LOCAL:** *(Optional)* A boolean value, specifies if the local build context should be used, or if the official repository will be cloned. If not supplied with the build command, it will default to `false`. | - **LOCAL:** *(Optional)* A boolean value, specifies if the local build context should be used, or if the official repository will be cloned. If not supplied with the build command, it will default to `false`. | ||||||
| - **GIT_REF:** *(Optional)* A git ref, like `HEAD` or a commit ID. The supplied ref will be used to create the Open Container Initiative compliant label `org.opencontainers.image.revision` and will be the ref that is cloned from the repository when not building from the local context. If not supplied with the build command, it will default to `HEAD`. | - **GIT_REF:** *(Optional)* A git ref, like `HEAD` or a commit ID. The supplied ref will be used to create the Open Container Initiative compliant label `org.opencontainers.image.revision` and will be the ref that is cloned from the repository when not building from the local context. If not supplied with the build command, it will default to `origin/master`. | ||||||
| 
 | 
 | ||||||
| To build the image you can use the following command | To build the image you can use the following command | ||||||
| 
 | 
 | ||||||
|  | @ -40,10 +40,12 @@ which also will tag the resulting image as `matrixconduit/matrix-conduit:latest` | ||||||
| After building the image you can simply run it with | After building the image you can simply run it with | ||||||
| 
 | 
 | ||||||
| ``` bash | ``` bash | ||||||
| docker run -d -p 8448:8000 -v db:/srv/conduit/.local/share/conduit -e ROCKET_SERVER_NAME="localhost:8000" matrixconduit/matrix-conduit:latest | docker run -d -p 8448:8000 -v ~/conduit.toml:/srv/conduit/conduit.toml -v db:/srv/conduit/.local/share/conduit matrixconduit/matrix-conduit:latest | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| For detached mode, you also need to use the `-d` flag. You can pass in more env vars as are shown here, for an overview of possible values, you can take a look at the `docker-compose.yml` file. | For detached mode, you also need to use the `-d` flag. You also need to supply a `conduit.toml` config file, you can find an example [here](../conduit-example.toml). | ||||||
|  | You can pass in different env vars to change config values on the fly. You can even configure Conduit completely by using env vars, but for that you need | ||||||
|  | too pass `-e CONDUIT_CONFIG=""` into your container. For an overview of possible values, please take a look at the `docker-compose.yml` file. | ||||||
| If you just want to test Conduit for a short time, you can use the `--rm` flag, which will clean up everything related to your container after you stop it. | If you just want to test Conduit for a short time, you can use the `--rm` flag, which will clean up everything related to your container after you stop it. | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -15,32 +15,39 @@ services: | ||||||
|         #         CREATED: |         #         CREATED: | ||||||
|         #         VERSION: |         #         VERSION: | ||||||
|         #         LOCAL: 'false' |         #         LOCAL: 'false' | ||||||
|         #         GIT_REF: HEAD |         #         GIT_REF: origin/master | ||||||
|         restart: unless-stopped |         restart: unless-stopped | ||||||
|         volumes: |         volumes: | ||||||
|             - db:/srv/conduit/.local/share/conduit |             - db:/srv/conduit/.local/share/conduit | ||||||
|             ### Uncomment if you want to use Rocket.toml to configure Conduit |             ### Uncomment if you want to use conduit.toml to configure Conduit | ||||||
|             ### Note: Set env vars will override Rocket.toml values |             ### Note: Set env vars will override conduit.toml values | ||||||
|             # - ./Rocket.toml:/srv/conduit/Rocket.toml |             # - ./conduit.toml:/srv/conduit/conduit.toml | ||||||
|         networks: |         networks: | ||||||
|             - proxy |             - proxy | ||||||
|         environment: |         environment: | ||||||
|             ROCKET_SERVER_NAME: localhost:8000  # replace with your own name |             CONDUIT_SERVER_NAME: localhost:8000  # replace with your own name | ||||||
|  |             CONDUIT_TRUSTED_SERVERS: | ||||||
|  |                 - 'matrix.org' | ||||||
|             ### Uncomment and change values as desired |             ### Uncomment and change values as desired | ||||||
|             # ROCKET_LOG: normal  # Available levels are: off, debug, normal, critical |             # CONDUIT_ADDRESS: 127.0.0.1 | ||||||
|             # ROCKET_PORT: 8000 |             # CONDUIT_PORT: 8000 | ||||||
|             # ROCKET_REGISTRATION_DISABLED: 'true' |             # CONDUIT_CONFIG: '/srv/conduit/conduit.toml'  # if want to configure purely by env vars, set this to an empty string '' | ||||||
|             # ROCKET_ENCRYPTION_DISABLED: 'true' |             # Available levels are: error, warn, info, debug, trace - more info at: https://docs.rs/env_logger/*/env_logger/#enabling-logging | ||||||
|             # ROCKET_DATABASE_PATH: /srv/conduit/.local/share/conduit |             # CONDUIT_LOG: info  # default is: "info,rocket=off,_=off,sled=off" | ||||||
|             # ROCKET_WORKERS: 10 |             # CONDUIT_ALLOW_JAEGER: 'false' | ||||||
|             # ROCKET_MAX_REQUEST_SIZE: 20_000_000  # in bytes, ~20 MB |             # CONDUIT_ALLOW_REGISTRATION : 'false' | ||||||
|  |             # CONDUIT_ALLOW_ENCRYPTION: 'false' | ||||||
|  |             # CONDUIT_ALLOW_FEDERATION: 'false' | ||||||
|  |             # CONDUIT_DATABASE_PATH: /srv/conduit/.local/share/conduit | ||||||
|  |             # CONDUIT_WORKERS: 10 | ||||||
|  |             # CONDUIT_MAX_REQUEST_SIZE: 20_000_000  # in bytes, ~20 MB | ||||||
| 
 | 
 | ||||||
|     ### Uncomment if you want to use your own Element-Web App. |     ### Uncomment if you want to use your own Element-Web App. | ||||||
|     ### Note: You need to provide a config.json for Element and you also need a second |     ### Note: You need to provide a config.json for Element and you also need a second | ||||||
|     ###       Domain or Subdomain for the communication between Element and Conduit |     ###       Domain or Subdomain for the communication between Element and Conduit | ||||||
|     ### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md |     ### Config-Docs: https://github.com/vector-im/element-web/blob/develop/docs/config.md | ||||||
|     # element-web: |     # element-web: | ||||||
|     #     image: vectorim/riot-web:latest |     #     image: vectorim/element-web:latest | ||||||
|     #     restart: unless-stopped |     #     restart: unless-stopped | ||||||
|     #     volumes: |     #     volumes: | ||||||
|     #         - ./element_config.json:/app/config.json |     #         - ./element_config.json:/app/config.json | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue