mirror of
				https://git.cloudron.io/cloudron/minio-app
				synced 2025-11-04 00:52:35 +00:00 
			
		
		
		
	Compare commits
	
		
			266 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					824337583f | ||
| 
						 | 
					99c29a629b | ||
| 
						 | 
					4b5422208c | ||
| 
						 | 
					3a7bdd5e39 | ||
| 
						 | 
					2fd201cb32 | ||
| 
						 | 
					12e40b8e6a | ||
| 
						 | 
					e6901e02ff | ||
| 
						 | 
					958a954c07 | ||
| 
						 | 
					901d877b5f | ||
| 
						 | 
					acc5e3c6be | ||
| 
						 | 
					c17b207a70 | ||
| 
						 | 
					0e681b6b1a | ||
| 
						 | 
					0bfd368aa2 | ||
| 
						 | 
					94abf5cd3e | ||
| 
						 | 
					9a9b0588ae | ||
| 
						 | 
					92a30fdd7c | ||
| 
						 | 
					07f1df3a20 | ||
| 
						 | 
					b624d6775c | ||
| 
						 | 
					330f186821 | ||
| 
						 | 
					72224538ea | ||
| 
						 | 
					fb1f583f4c | ||
| 
						 | 
					5699a05783 | ||
| 
						 | 
					64222e227e | ||
| 
						 | 
					8f7a046554 | ||
| 
						 | 
					3717901b12 | ||
| 
						 | 
					85f4a808be | ||
| 
						 | 
					9d1b7e1a9d | ||
| 
						 | 
					9bea0cc891 | ||
| 
						 | 
					557a8acd3d | ||
| 
						 | 
					fb1db2809a | ||
| 
						 | 
					7fcfa2d793 | ||
| 
						 | 
					2e71a424d6 | ||
| 
						 | 
					d5ed478302 | ||
| 
						 | 
					63240d9ef7 | ||
| 
						 | 
					ea84113aa7 | ||
| 
						 | 
					d70ab90edf | ||
| 
						 | 
					47ca8d4426 | ||
| 
						 | 
					a6c683af4d | ||
| 
						 | 
					b64d0c834b | ||
| 
						 | 
					8aab79757f | ||
| 
						 | 
					4d0ed6744f | ||
| 
						 | 
					5f7d71f028 | ||
| 
						 | 
					26e95361b6 | ||
| 
						 | 
					5cee1588f3 | ||
| 
						 | 
					d8c7fa0d47 | ||
| 
						 | 
					2f8caf38d4 | ||
| 
						 | 
					51850a87d8 | ||
| 
						 | 
					9a9367d5f4 | ||
| 
						 | 
					bedc600aa5 | ||
| 
						 | 
					368da33581 | ||
| 
						 | 
					ca6eaad35d | ||
| 
						 | 
					e47f31b8a8 | ||
| 
						 | 
					05c08cdafe | ||
| 
						 | 
					af2efcfd46 | ||
| 
						 | 
					042e08f7ad | ||
| 
						 | 
					5f6b3ef9c3 | ||
| 
						 | 
					0e6b93f732 | ||
| 
						 | 
					2b7aff15d3 | ||
| 
						 | 
					febd561bfb | ||
| 
						 | 
					abef481b63 | ||
| 
						 | 
					2b0dcc7d38 | ||
| 
						 | 
					0c32be8139 | ||
| 
						 | 
					fd04e1b784 | ||
| 
						 | 
					bd883b747c | ||
| 
						 | 
					618c3c6736 | ||
| 
						 | 
					fba9a4ff32 | ||
| 
						 | 
					7878d690b9 | ||
| 
						 | 
					623b291e62 | ||
| 
						 | 
					74bc0cbbd2 | ||
| 
						 | 
					316047b1d3 | ||
| 
						 | 
					569e830514 | ||
| 
						 | 
					7417ce44e5 | ||
| 
						 | 
					88918c602a | ||
| 
						 | 
					7b26be880d | ||
| 
						 | 
					e966943be5 | ||
| 
						 | 
					dd46a7f8e9 | ||
| 
						 | 
					5295380629 | ||
| 
						 | 
					22f00b1803 | ||
| 
						 | 
					8315f77f5c | ||
| 
						 | 
					e1a29850c8 | ||
| 
						 | 
					c94a90e4ab | ||
| 
						 | 
					d4ec80fab3 | ||
| 
						 | 
					682dd521a1 | ||
| 
						 | 
					cd7055c916 | ||
| 
						 | 
					6d385533b3 | ||
| 
						 | 
					36d669ad59 | ||
| 
						 | 
					cc5e013c1f | ||
| 
						 | 
					20bbaff551 | ||
| 
						 | 
					d39b1cb50f | ||
| 
						 | 
					0dec46fdc0 | ||
| 
						 | 
					9d8938b7bf | ||
| 
						 | 
					4f43bc611e | ||
| 
						 | 
					db768973d6 | ||
| 
						 | 
					db0d84862d | ||
| 
						 | 
					0e70c439cf | ||
| 
						 | 
					59ed1a0fc1 | ||
| 
						 | 
					6542475614 | ||
| 
						 | 
					9cffe692df | ||
| 
						 | 
					eeac9f0af4 | ||
| 
						 | 
					b1fe43b656 | ||
| 
						 | 
					eb93b292fa | ||
| 
						 | 
					aea86c627d | ||
| 
						 | 
					454d83318c | ||
| 
						 | 
					fed871de22 | ||
| 
						 | 
					648231e821 | ||
| 
						 | 
					927cdbb0a2 | ||
| 
						 | 
					cb61faa569 | ||
| 
						 | 
					cf11bcd7e6 | ||
| 
						 | 
					669976c293 | ||
| 
						 | 
					951a874909 | ||
| 
						 | 
					0bb46d9867 | ||
| 
						 | 
					540ad857fd | ||
| 
						 | 
					c06f2d9e9d | ||
| 
						 | 
					0d96abc3c8 | ||
| 
						 | 
					63f6910f5f | ||
| 
						 | 
					b09a9cc6ea | ||
| 
						 | 
					b0f6a030f3 | ||
| 
						 | 
					84b4ebeac4 | ||
| 
						 | 
					c5404f53c1 | ||
| 
						 | 
					cacf9d9441 | ||
| 
						 | 
					3b1eecfd73 | ||
| 
						 | 
					237a7747d9 | ||
| 
						 | 
					ce4f12fbd6 | ||
| 
						 | 
					7e14939670 | ||
| 
						 | 
					1de078ee2a | ||
| 
						 | 
					533b6d91e6 | ||
| 
						 | 
					ef4bdec677 | ||
| 
						 | 
					da470851f7 | ||
| 
						 | 
					242ed4386b | ||
| 
						 | 
					11bb0c8edc | ||
| 
						 | 
					4ac71ff8e7 | ||
| 
						 | 
					05cbddd40e | ||
| 
						 | 
					1ecb2e3593 | ||
| 
						 | 
					124bc9e833 | ||
| 
						 | 
					c5a3a190b2 | ||
| 
						 | 
					97e6ae5a6f | ||
| 
						 | 
					dfa728d7a5 | ||
| 
						 | 
					f06d703fce | ||
| 
						 | 
					c78df06cb7 | ||
| 
						 | 
					87859252ce | ||
| 
						 | 
					9ef74c45d5 | ||
| 
						 | 
					e551d6535d | ||
| 
						 | 
					9a97ef5913 | ||
| 
						 | 
					ac937559e0 | ||
| 
						 | 
					3b4e8d04de | ||
| 
						 | 
					4d3cd5ed61 | ||
| 
						 | 
					9e5aa33e09 | ||
| 
						 | 
					4f3e70f3e0 | ||
| 
						 | 
					270a7cd6ee | ||
| 
						 | 
					da87188fad | ||
| 
						 | 
					16df482288 | ||
| 
						 | 
					0524be735e | ||
| 
						 | 
					a4451ecb22 | ||
| 
						 | 
					f452505ae7 | ||
| 
						 | 
					1fe052d819 | ||
| 
						 | 
					ba1a52dc5e | ||
| 
						 | 
					5b7a96134f | ||
| 
						 | 
					1366fc8932 | ||
| 
						 | 
					d9bdf5749e | ||
| 
						 | 
					2c30861af0 | ||
| 
						 | 
					37157e6538 | ||
| 
						 | 
					38e110edc7 | ||
| 
						 | 
					758b98fc20 | ||
| 
						 | 
					b92644ffdd | ||
| 
						 | 
					3b9e31f363 | ||
| 
						 | 
					17d5977c74 | ||
| 
						 | 
					d898eba22e | ||
| 
						 | 
					9c6a787df9 | ||
| 
						 | 
					9f4fc4c2f2 | ||
| 
						 | 
					2f271c7db9 | ||
| 
						 | 
					30f7bbf53b | ||
| 
						 | 
					b246112d3f | ||
| 
						 | 
					986df393a1 | ||
| 
						 | 
					d5b3bd9c2f | ||
| 
						 | 
					c1ce6031f7 | ||
| 
						 | 
					9c5f6b5636 | ||
| 
						 | 
					7fa5fa0427 | ||
| 
						 | 
					55711af940 | ||
| 
						 | 
					7a3ee2504f | ||
| 
						 | 
					c2388d2710 | ||
| 
						 | 
					81186e53f4 | ||
| 
						 | 
					f37fd6a660 | ||
| 
						 | 
					365254e971 | ||
| 
						 | 
					665851a84a | ||
| 
						 | 
					a625014aeb | ||
| 
						 | 
					25ff8b66f6 | ||
| 
						 | 
					2fbefac3a9 | ||
| 
						 | 
					2bbf11f795 | ||
| 
						 | 
					ca3aebef4a | ||
| 
						 | 
					effb90c2ac | ||
| 
						 | 
					e8972242ca | ||
| 
						 | 
					e84ef0cddf | ||
| 
						 | 
					594b45051d | ||
| 
						 | 
					ed8e041180 | ||
| 
						 | 
					f9c0870c59 | ||
| 
						 | 
					550ea43e59 | ||
| 
						 | 
					832f1f26a8 | ||
| 
						 | 
					293beffadc | ||
| 
						 | 
					29f3101513 | ||
| 
						 | 
					ef6edee2a1 | ||
| 
						 | 
					e00e95eb94 | ||
| 
						 | 
					f6a78ee7cb | ||
| 
						 | 
					c32fc59b39 | ||
| 
						 | 
					78913a6f02 | ||
| 
						 | 
					9964fd0db8 | ||
| 
						 | 
					86ebec77eb | ||
| 
						 | 
					281ec626e3 | ||
| 
						 | 
					6f76e442fc | ||
| 
						 | 
					c720de4dcf | ||
| 
						 | 
					32a649b52a | ||
| 
						 | 
					08f1230582 | ||
| 
						 | 
					eda4dd653f | ||
| 
						 | 
					d49de43f6b | ||
| 
						 | 
					d385379da8 | ||
| 
						 | 
					40f6e1675d | ||
| 
						 | 
					19d114beda | ||
| 
						 | 
					13329afe50 | ||
| 
						 | 
					8feb8dd0e3 | ||
| 
						 | 
					1370d93592 | ||
| 
						 | 
					d24e4b9896 | ||
| 
						 | 
					b279130d74 | ||
| 
						 | 
					3504fc48f9 | ||
| 
						 | 
					1ac3bbe134 | ||
| 
						 | 
					fe7fd0147c | ||
| 
						 | 
					0047b6bd3b | ||
| 
						 | 
					b4e59c928c | ||
| 
						 | 
					d33cff8f0a | ||
| 
						 | 
					4eb440baaf | ||
| 
						 | 
					96e54e6b3c | ||
| 
						 | 
					bfbe792135 | ||
| 
						 | 
					31bbeed39f | ||
| 
						 | 
					9a175b6685 | ||
| 
						 | 
					a6e36be63d | ||
| 
						 | 
					9a348b2de6 | ||
| 
						 | 
					c696512b49 | ||
| 
						 | 
					cc1385c856 | ||
| 
						 | 
					89a6b2407b | ||
| 
						 | 
					36d5d82e88 | ||
| 
						 | 
					8252a3ee75 | ||
| 
						 | 
					c71586f092 | ||
| 
						 | 
					09408ff9d4 | ||
| 
						 | 
					661c07147e | ||
| 
						 | 
					02d58cec8b | ||
| 
						 | 
					e43de3a0e0 | ||
| 
						 | 
					e391ed9d85 | ||
| 
						 | 
					2c9a35effb | ||
| 
						 | 
					9ee3f02a10 | ||
| 
						 | 
					15f02a8d0f | ||
| 
						 | 
					48ffc5257c | ||
| 
						 | 
					7fad1aea6d | ||
| 
						 | 
					aeb58c292f | ||
| 
						 | 
					bcee168e84 | ||
| 
						 | 
					150b220bf2 | ||
| 
						 | 
					43403829eb | ||
| 
						 | 
					75b4da6645 | ||
| 
						 | 
					e0f1511552 | ||
| 
						 | 
					338371b948 | ||
| 
						 | 
					efa30f5115 | ||
| 
						 | 
					90fa9036cb | ||
| 
						 | 
					15b4ed267b | ||
| 
						 | 
					67294dd890 | ||
| 
						 | 
					aad0197fff | ||
| 
						 | 
					b4a820e079 | ||
| 
						 | 
					20cc0c935f | ||
| 
						 | 
					b7f575fcf9 | ||
| 
						 | 
					7f3a0acab2 | 
@@ -5,10 +5,10 @@
 | 
			
		||||
  "description": "file://DESCRIPTION.md",
 | 
			
		||||
  "changelog": "file://CHANGELOG",
 | 
			
		||||
  "tagline": "Distributed object storage",
 | 
			
		||||
  "version": "3.0.1",
 | 
			
		||||
  "upstreamVersion": "2022-11-10T18-20-21Z",
 | 
			
		||||
  "version": "3.13.26",
 | 
			
		||||
  "upstreamVersion": "2024-07-04T14-25-45Z",
 | 
			
		||||
  "healthCheckPath": "/minio/login",
 | 
			
		||||
  "memoryLimit": 805306368,
 | 
			
		||||
  "memoryLimit": 2147483648,
 | 
			
		||||
  "httpPort": 8000,
 | 
			
		||||
  "httpPorts": {
 | 
			
		||||
    "API_SERVER_DOMAIN": {
 | 
			
		||||
@@ -19,8 +19,10 @@
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "addons": {
 | 
			
		||||
    "localstorage": {}
 | 
			
		||||
    "localstorage": {},
 | 
			
		||||
    "oidc": { "loginRedirectUri": "/oauth_callback" }
 | 
			
		||||
  },
 | 
			
		||||
  "optionalSso": true,
 | 
			
		||||
  "manifestVersion": 2,
 | 
			
		||||
  "website": "http://www.minio.io",
 | 
			
		||||
  "minBoxVersion": "7.1.2",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
FROM cloudron/base:3.2.0@sha256:ba1d566164a67c266782545ea9809dc611c4152e27686fd14060332dd88263ea
 | 
			
		||||
FROM cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4
 | 
			
		||||
 | 
			
		||||
RUN mkdir -p /app/code
 | 
			
		||||
WORKDIR /app/code
 | 
			
		||||
 | 
			
		||||
ARG VERSION=RELEASE.2022-11-10T18-20-21Z
 | 
			
		||||
ARG VERSION=RELEASE.2024-07-04T14-25-45Z
 | 
			
		||||
 | 
			
		||||
# sometimes here https://dl.min.io/server/minio/release/linux-amd64/archive/
 | 
			
		||||
# RUN wget https://dl.min.io/server/minio/release/linux-amd64/minio.${VERSION} -O /app/code/minio && chmod +x /app/code/minio
 | 
			
		||||
@@ -11,6 +11,6 @@ RUN wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio.${VERS
 | 
			
		||||
# https://dl.min.io/client/mc/release/linux-amd64/
 | 
			
		||||
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /app/code/mc && chmod +x /app/code/mc
 | 
			
		||||
 | 
			
		||||
COPY env.sh start.sh /app/code/
 | 
			
		||||
COPY env.sh.template start.sh /app/code/
 | 
			
		||||
 | 
			
		||||
CMD [ "/app/code/start.sh" ]
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,19 @@
 | 
			
		||||
<nosso>
 | 
			
		||||
Please use the following credentials to login:
 | 
			
		||||
 | 
			
		||||
**Username**: minioadmin<br/>
 | 
			
		||||
**Password**: minioadmin<br/>
 | 
			
		||||
 | 
			
		||||
Please change the credentials immediately by following this [guide](https://cloudron.io/documentation/apps/minio/#admin-credentials).
 | 
			
		||||
</nosso>
 | 
			
		||||
 | 
			
		||||
<sso>
 | 
			
		||||
 | 
			
		||||
Please use the following credentials to login via 'Other Authentication Methods' -> 'Use Credentials':
 | 
			
		||||
 | 
			
		||||
**Username**: minioadmin<br/>
 | 
			
		||||
**Password**: See `MINIO_ROOT_PASSWORD` in `/app/data/env.sh` <a href="/frontend/filemanager.html#/viewer/app/$CLOUDRON-APP-ID/env.sh">Open File Manager</a><br/>
 | 
			
		||||
 | 
			
		||||
Cloudron users have `readwrite` access policy. See the [docs](https://cloudron.io/documentation/apps/minio/#admin-credentials) on how to change it.
 | 
			
		||||
 | 
			
		||||
</nosso>
 | 
			
		||||
 
 | 
			
		||||
@@ -37,3 +37,8 @@ PATH=$PATH:node_modules/.bin mocha --bail test.js
 | 
			
		||||
## Notes
 | 
			
		||||
 | 
			
		||||
MinIO Console is an embedded web-based object browser built into MinIO Server
 | 
			
		||||
 | 
			
		||||
## Multi-domain
 | 
			
		||||
 | 
			
		||||
MINIO_DOMAIN=domain.com env var can be set to server DNS style requests as bucket.domain.com . This requires the platform code to set aliases for the httpPorts and not the primaryport.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								env.sh
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								env.sh
									
									
									
									
									
								
							@@ -1,9 +0,0 @@
 | 
			
		||||
# Add custom minio configuration to this file. Restart the app for changes to take effect.
 | 
			
		||||
 | 
			
		||||
export CLOUDRON_MINIO_STARTUP_ARGS='server /app/data/data'
 | 
			
		||||
 | 
			
		||||
# See https://docs.min.io/minio/baremetal/reference/minio-server/minio-server.html#envvar.MINIO_ROOT_USER
 | 
			
		||||
# You can use pwgen -1s 64 to generate usernames and passwords
 | 
			
		||||
export MINIO_ROOT_USER=minioadmin
 | 
			
		||||
export MINIO_ROOT_PASSWORD=minioadmin
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								env.sh.template
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								env.sh.template
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
# Add custom minio configuration to this file. Restart the app for changes to take effect.
 | 
			
		||||
 | 
			
		||||
export CLOUDRON_MINIO_STARTUP_ARGS='server /app/data/data'
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								start.sh
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								start.sh
									
									
									
									
									
								
							@@ -4,7 +4,19 @@ set -eu
 | 
			
		||||
 | 
			
		||||
mkdir -p /app/data/data /run/minio/config /run/minio/certs
 | 
			
		||||
 | 
			
		||||
[[ ! -f /app/data/env.sh ]] && cp /app/code/env.sh /app/data/env.sh
 | 
			
		||||
# env vars take precedence over config.yaml (https://github.com/minio/minio/blob/master/docs/distributed/CONFIG.md#things-to-know)
 | 
			
		||||
if [[ ! -f /app/data/env.sh ]]; then
 | 
			
		||||
    echo "=> First run"
 | 
			
		||||
    cp /app/code/env.sh.template /app/data/env.sh
 | 
			
		||||
    # minio does not show the password login by default when OIDC is setup (https://github.com/minio/minio/discussions/16928)
 | 
			
		||||
    # we generate a dynamic password because users might forget to change the admin password (with the oidc login being so click friendly)
 | 
			
		||||
    if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
 | 
			
		||||
        echo -e "export MINIO_ROOT_USER=minioadmin\nexport MINIO_ROOT_PASSWORD=$(pwgen -1s 20)\n\n" >> /app/data/env.sh
 | 
			
		||||
    else
 | 
			
		||||
        echo -e "export MINIO_ROOT_USER=minioadmin\nexport MINIO_ROOT_PASSWORD=minioadmin\n\n" >> /app/data/env.sh
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
source /app/data/env.sh
 | 
			
		||||
 | 
			
		||||
# https://docs.min.io/minio/baremetal/reference/minio-server/minio-server.html#envvar.MINIO_SERVER_URL
 | 
			
		||||
@@ -16,11 +28,23 @@ if [[ ! -d /app/data/mc_config ]]; then
 | 
			
		||||
    /app/code/mc --config-dir /app/data/mc_config &> /dev/null || true
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
 | 
			
		||||
    export MINIO_IDENTITY_OPENID_DISPLAY_NAME="Cloudron"
 | 
			
		||||
    export MINIO_IDENTITY_OPENID_CONFIG_URL="${CLOUDRON_OIDC_DISCOVERY_URL}"
 | 
			
		||||
    export MINIO_IDENTITY_OPENID_CLIENT_ID="${CLOUDRON_OIDC_CLIENT_ID}"
 | 
			
		||||
    export MINIO_IDENTITY_OPENID_CLIENT_SECRET="${CLOUDRON_OIDC_CLIENT_SECRET}"
 | 
			
		||||
    export MINIO_IDENTITY_OPENID_SCOPES="openid profile email"
 | 
			
		||||
    if [[ -z "${MINIO_IDENTITY_OPENID_ROLE_POLICY:-}" ]]; then
 | 
			
		||||
        export MINIO_IDENTITY_OPENID_ROLE_POLICY="readwrite"
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    export MINIO_IDENTITY_OPENID_COMMENT="Cloudron OIDC"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# minio is used for backups at times and has a large number of files. optimize by checking if files are actually in correct chown state
 | 
			
		||||
echo "==> Changing ownership"
 | 
			
		||||
[[ $(stat --format '%U' /app/data/data) != "cloudron" ]] && chown -R cloudron:cloudron /app/data
 | 
			
		||||
 | 
			
		||||
# the --config-dir is deprecated and not used. but without it, minio will try to create $HOME/.minio :/ same for --certs-dir
 | 
			
		||||
echo "==> Starting minio"
 | 
			
		||||
exec /usr/local/bin/gosu cloudron:cloudron /app/code/minio --certs-dir /run/minio/certs --config-dir /run/minio/config --quiet ${CLOUDRON_MINIO_STARTUP_ARGS} --address :9000 --console-address :8000
 | 
			
		||||
exec /usr/local/bin/gosu cloudron:cloudron /app/code/minio --quiet ${CLOUDRON_MINIO_STARTUP_ARGS} --address :9000 --console-address :8000
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1909
									
								
								test/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1909
									
								
								test/package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -9,11 +9,10 @@
 | 
			
		||||
  "author": "",
 | 
			
		||||
  "license": "ISC",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "chromedriver": "^106.0.1",
 | 
			
		||||
    "delay": "^5.0.0",
 | 
			
		||||
    "chromedriver": "^126.0.4",
 | 
			
		||||
    "expect.js": "^0.3.1",
 | 
			
		||||
    "mocha": "^10.1.0",
 | 
			
		||||
    "selenium-webdriver": "^4.5.0",
 | 
			
		||||
    "superagent": "^8.0.3"
 | 
			
		||||
    "mocha": "^10.6.0",
 | 
			
		||||
    "selenium-webdriver": "^4.22.0",
 | 
			
		||||
    "superagent": "^9.0.2"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										180
									
								
								test/test.js
									
									
									
									
									
								
							
							
						
						
									
										180
									
								
								test/test.js
									
									
									
									
									
								
							@@ -11,24 +11,32 @@
 | 
			
		||||
 | 
			
		||||
require('chromedriver');
 | 
			
		||||
 | 
			
		||||
const delay = require('delay'),
 | 
			
		||||
    execSync = require('child_process').execSync,
 | 
			
		||||
const execSync = require('child_process').execSync,
 | 
			
		||||
    expect = require('expect.js'),
 | 
			
		||||
    fs = require('fs'),
 | 
			
		||||
    path = require('path'),
 | 
			
		||||
    superagent = require('superagent'),
 | 
			
		||||
    timers = require('timers/promises'),
 | 
			
		||||
    { Builder, By, until } = require('selenium-webdriver'),
 | 
			
		||||
    { Options } = require('selenium-webdriver/chrome');
 | 
			
		||||
 | 
			
		||||
if (!process.env.USERNAME || !process.env.PASSWORD) {
 | 
			
		||||
    console.log('USERNAME and PASSWORD env vars need to be set');
 | 
			
		||||
    process.exit(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
describe('Application life cycle test', function () {
 | 
			
		||||
    this.timeout(0);
 | 
			
		||||
 | 
			
		||||
    const LOCATION = 'test';
 | 
			
		||||
    const TEST_TIMEOUT = 30000;
 | 
			
		||||
    const TEST_TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 30000;
 | 
			
		||||
    const BUCKET = 'cloudrontestbucket';
 | 
			
		||||
    const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
 | 
			
		||||
 | 
			
		||||
    let browser, app;
 | 
			
		||||
    let athenticated_by_oidc = false, rootPassword;
 | 
			
		||||
    let username = process.env.USERNAME;
 | 
			
		||||
    let password = process.env.PASSWORD;
 | 
			
		||||
 | 
			
		||||
    before(function () {
 | 
			
		||||
        browser = new Builder().forBrowser('chrome').setChromeOptions(new Options().windowSize({ width: 1280, height: 1024 })).build();
 | 
			
		||||
@@ -49,23 +57,58 @@ describe('Application life cycle test', function () {
 | 
			
		||||
        expect(app).to.be.an('object');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async function login(accessKey='minioadmin', secretKey='minioadmin') {
 | 
			
		||||
    async function login(username, password, expandLoginForm=true) {
 | 
			
		||||
        await browser.manage().deleteAllCookies();
 | 
			
		||||
        await browser.get('about:blank');
 | 
			
		||||
        await browser.sleep(2000);
 | 
			
		||||
        await browser.get(`https://${app.fqdn}/login`);
 | 
			
		||||
        await browser.sleep(2000);
 | 
			
		||||
 | 
			
		||||
        if (expandLoginForm) {
 | 
			
		||||
            await waitForElement(By.xpath('//div[@id="alternativeMethods-select"]/div[contains(., "Other Authentication Methods")]'));
 | 
			
		||||
            await browser.findElement(By.xpath('//div[@id="alternativeMethods-select"]/div[contains(., "Other Authentication Methods")]')).click();
 | 
			
		||||
            await browser.sleep(2000);
 | 
			
		||||
            await browser.findElement(By.xpath('//li[contains(., "Use Credentials")] | //div[@label="Use Credentials"]')).click();
 | 
			
		||||
            await browser.sleep(2000);
 | 
			
		||||
        }
 | 
			
		||||
        await waitForElement(By.id('accessKey'));
 | 
			
		||||
        await browser.findElement(By.id('accessKey')).sendKeys(accessKey);
 | 
			
		||||
        await browser.findElement(By.id('secretKey')).sendKeys(secretKey);
 | 
			
		||||
        await browser.findElement(By.id('accessKey')).sendKeys(username);
 | 
			
		||||
        await browser.findElement(By.id('secretKey')).sendKeys(password);
 | 
			
		||||
        await browser.findElement(By.xpath('//button[@id="do-login"]')).click();
 | 
			
		||||
        await waitForElement(By.xpath('//span[contains(text(), "Buckets")]'));
 | 
			
		||||
        await delay(5000);
 | 
			
		||||
        await timers.setTimeout(5000);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async function loginOIDC(username, password) {
 | 
			
		||||
        browser.manage().deleteAllCookies();
 | 
			
		||||
        await browser.get(`https://${app.fqdn}/login`);
 | 
			
		||||
        await browser.sleep(10000);
 | 
			
		||||
 | 
			
		||||
        await browser.findElement(By.xpath('//button[contains(., "Cloudron")]')).click();
 | 
			
		||||
        await browser.sleep(10000);
 | 
			
		||||
 | 
			
		||||
        if (!athenticated_by_oidc) {
 | 
			
		||||
            await waitForElement(By.xpath('//input[@name="username"]'));
 | 
			
		||||
            await browser.findElement(By.xpath('//input[@name="username"]')).sendKeys(username);
 | 
			
		||||
            await browser.findElement(By.xpath('//input[@name="password"]')).sendKeys(password);
 | 
			
		||||
            await browser.sleep(2000);
 | 
			
		||||
            await browser.findElement(By.id('loginSubmitButton')).click();
 | 
			
		||||
            await browser.sleep(2000);
 | 
			
		||||
 | 
			
		||||
            athenticated_by_oidc = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        await waitForElement(By.xpath('//span[contains(text(), "Buckets")]'));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async function logout() {
 | 
			
		||||
        await browser.get(`https://${app.fqdn}/`);
 | 
			
		||||
        await waitForElement(By.xpath('//span[contains(text(), "Buckets")]'));
 | 
			
		||||
        const button = await browser.findElement(By.xpath('//div/span[contains(text(), "Sign Out")]'));
 | 
			
		||||
        const button = await browser.findElement(By.xpath('//button[@id="sign-out"]'));
 | 
			
		||||
        await browser.executeScript('arguments[0].scrollIntoView(false)', button);
 | 
			
		||||
        await button.click();
 | 
			
		||||
        await waitForElement(By.id('accessKey'));
 | 
			
		||||
        await browser.sleep(10000); // needed!
 | 
			
		||||
        await waitForElement(By.xpath('//*[@id="accessKey"] | //button[contains(., "Cloudron")]'));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async function addBucket() {
 | 
			
		||||
@@ -75,8 +118,8 @@ describe('Application life cycle test', function () {
 | 
			
		||||
        await browser.sleep(2000);
 | 
			
		||||
        await browser.findElement(By.xpath('//input[@id="bucket-name"]')).sendKeys(BUCKET);
 | 
			
		||||
        await browser.findElement(By.xpath('//button[@id="create-bucket"]')).click();
 | 
			
		||||
        await waitForElement(By.xpath(`//a[contains(text(), "${BUCKET}")]`));
 | 
			
		||||
        await delay(5000);
 | 
			
		||||
        await waitForElement(By.xpath(`//h1[contains(text(), "${BUCKET}")]`));
 | 
			
		||||
        await timers.setTimeout(5000);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async function checkBucket() {
 | 
			
		||||
@@ -96,38 +139,87 @@ describe('Application life cycle test', function () {
 | 
			
		||||
        expect(response.body.toString('utf8')).to.contain('<Code>AccessDenied</Code>');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async function changeAdminCredentials() {
 | 
			
		||||
        let data = fs.readFileSync(path.join(__dirname, '../env.sh.template'), 'utf8');
 | 
			
		||||
        data += '\nexport MINIO_ROOT_USER=minioakey\nexport MINIO_ROOT_PASSWORD=minioskey\n';
 | 
			
		||||
        fs.writeFileSync('/tmp/env.sh', data);
 | 
			
		||||
        execSync(`cloudron push --app ${app.id} /tmp/env.sh /app/data/env.sh`, EXEC_ARGS);
 | 
			
		||||
        execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS);
 | 
			
		||||
        await timers.setTimeout(10000);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async function getAdminCredentials() {
 | 
			
		||||
        execSync(`cloudron pull --app ${app.id} /app/data/env.sh /tmp/env.sh`, EXEC_ARGS);
 | 
			
		||||
        const data = fs.readFileSync('/tmp/env.sh', 'utf8');
 | 
			
		||||
        const m = data.match(/MINIO_ROOT_PASSWORD=(.*)/);
 | 
			
		||||
        if (!m) throw new Error('Could not detect root password');
 | 
			
		||||
        rootPassword = m[1].trim();
 | 
			
		||||
        console.log(`root password is [${rootPassword}]`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
 | 
			
		||||
    it('install app', async function () {
 | 
			
		||||
        execSync(`cloudron install --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS);
 | 
			
		||||
        await delay(10000);
 | 
			
		||||
 | 
			
		||||
    // // no SSO
 | 
			
		||||
    it('install app (no SSO)', async function () {
 | 
			
		||||
        execSync(`cloudron install --no-sso --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS);
 | 
			
		||||
        await timers.setTimeout(10000);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('can get app information', getAppInfo);
 | 
			
		||||
 | 
			
		||||
    it('can login', login.bind(null, 'minioadmin', 'minioadmin'));
 | 
			
		||||
    it('can admin login', login.bind(null, 'minioadmin', 'minioadmin', false));
 | 
			
		||||
    it('can add bucket', addBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
    it('does redirect', checkRedirect);
 | 
			
		||||
    it('check api', checkApi);
 | 
			
		||||
 | 
			
		||||
    it('can change credentials', async function () {
 | 
			
		||||
        let data = fs.readFileSync(path.join(__dirname, '../env.sh'), 'utf8');
 | 
			
		||||
        data = data
 | 
			
		||||
            .replace(/MINIO_ROOT_USER=.*/, 'MINIO_ROOT_USER=minioakey')
 | 
			
		||||
            .replace(/MINIO_ROOT_PASSWORD=.*/, 'MINIO_ROOT_PASSWORD=minioskey');
 | 
			
		||||
        fs.writeFileSync('/tmp/env.sh', data);
 | 
			
		||||
        execSync(`cloudron push --app ${app.id} /tmp/env.sh /app/data/env.sh`, EXEC_ARGS);
 | 
			
		||||
    it('can change admin credentials', changeAdminCredentials);
 | 
			
		||||
    it('can restart app', async function () {
 | 
			
		||||
        execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS);
 | 
			
		||||
        await delay(10000);
 | 
			
		||||
        await timers.setTimeout(10000);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('can restart app', function () { execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS); });
 | 
			
		||||
 | 
			
		||||
    it('can login', login.bind(null, 'minioakey', 'minioskey'));
 | 
			
		||||
    it('can admin login', login.bind(null, 'minioakey', 'minioskey', false));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
    it('does redirect', checkRedirect);
 | 
			
		||||
    it('check api', checkApi);
 | 
			
		||||
    it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); });
 | 
			
		||||
 | 
			
		||||
    // SSO
 | 
			
		||||
    it('install app (SSO)', async function () {
 | 
			
		||||
        execSync(`cloudron install --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS);
 | 
			
		||||
        await timers.setTimeout(10000);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('can get app information', getAppInfo);
 | 
			
		||||
    it('can get admin credentials', getAdminCredentials);
 | 
			
		||||
    it('can admin login', async function () { await login('minioadmin', rootPassword); });
 | 
			
		||||
    it('can add bucket', addBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
    it('does redirect', checkRedirect);
 | 
			
		||||
    it('check api', checkApi);
 | 
			
		||||
 | 
			
		||||
    it('can OIDC login', loginOIDC.bind(null, username, password));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('can change admin credentials', changeAdminCredentials);
 | 
			
		||||
 | 
			
		||||
    it('can restart app', async function () {
 | 
			
		||||
        execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS);
 | 
			
		||||
        await timers.setTimeout(10000);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('can admin login', login.bind(null, 'minioakey', 'minioskey'));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
    it('does redirect', checkRedirect);
 | 
			
		||||
    it('check api', checkApi);
 | 
			
		||||
 | 
			
		||||
    it('can OIDC login', loginOIDC.bind(null, username, password));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
 | 
			
		||||
    it('restore app', async function () {
 | 
			
		||||
@@ -136,44 +228,66 @@ describe('Application life cycle test', function () {
 | 
			
		||||
        execSync('cloudron install --location ' + LOCATION, EXEC_ARGS);
 | 
			
		||||
        getAppInfo();
 | 
			
		||||
        execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS);
 | 
			
		||||
        await delay(10000);
 | 
			
		||||
        await timers.setTimeout(10000);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('can login', login.bind(null, 'minioakey', 'minioskey'));
 | 
			
		||||
    it('can get app information', getAppInfo);
 | 
			
		||||
    it('can admin login', login.bind(null, 'minioakey', 'minioskey'));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('can OIDC login', loginOIDC.bind(null, username, password));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('does redirect', checkRedirect);
 | 
			
		||||
    it('check api', checkApi);
 | 
			
		||||
 | 
			
		||||
    it('move to different location', async function () {
 | 
			
		||||
        browser.manage().deleteAllCookies();
 | 
			
		||||
        execSync('cloudron configure --location ' + LOCATION + '2', EXEC_ARGS);
 | 
			
		||||
        await delay(10000);
 | 
			
		||||
        await timers.setTimeout(10000);
 | 
			
		||||
    });
 | 
			
		||||
    it('can get app information', getAppInfo);
 | 
			
		||||
 | 
			
		||||
    it('can login', login.bind(null, 'minioakey', 'minioskey'));
 | 
			
		||||
    it('can admin login', login.bind(null, 'minioakey', 'minioskey'));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('can OIDC login', loginOIDC.bind(null, username, password));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('does redirect', checkRedirect);
 | 
			
		||||
    it('check api', checkApi);
 | 
			
		||||
 | 
			
		||||
    it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); });
 | 
			
		||||
 | 
			
		||||
    // test update
 | 
			
		||||
    it('can install app', function () { execSync('cloudron install --appstore-id io.minio.cloudronapp --location ' + LOCATION, EXEC_ARGS); });
 | 
			
		||||
    it('can install app for update', function () { execSync('cloudron install --appstore-id io.minio.cloudronapp --location ' + LOCATION, EXEC_ARGS); });
 | 
			
		||||
    it('can get app information', getAppInfo);
 | 
			
		||||
 | 
			
		||||
    it('can login', login.bind(null, 'minioadmin', 'minioadmin'));
 | 
			
		||||
    it('can get admin credentials', getAdminCredentials);
 | 
			
		||||
    it('can admin login', async function () { await login('minioadmin', rootPassword); });
 | 
			
		||||
    it('can add buckets', addBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('can OIDC login', loginOIDC.bind(null, username, password));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('can update', function () { execSync(`cloudron update --app ${LOCATION}`, EXEC_ARGS); });
 | 
			
		||||
    it('can configure', function () { execSync(`cloudron configure --app ${LOCATION} --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS); });
 | 
			
		||||
    it('can get app information', getAppInfo);
 | 
			
		||||
 | 
			
		||||
    it('can login', login.bind(null, 'minioadmin', 'minioadmin'));
 | 
			
		||||
    it('can admin login', async function () { await login('minioadmin', rootPassword); });
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('can OIDC login', loginOIDC.bind(null, username, password));
 | 
			
		||||
    it('has bucket', checkBucket);
 | 
			
		||||
    it('can logout', logout);
 | 
			
		||||
 | 
			
		||||
    it('does redirect', checkRedirect);
 | 
			
		||||
    it('check api', checkApi);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user