diff --git a/.github/README.md b/.github/README.md index 405095f..89544d6 100644 --- a/.github/README.md +++ b/.github/README.md @@ -162,19 +162,10 @@ npm run setup && docker-compose restart Easy! Just pull the changes & run this one-liner: ```bash -# Pull the latest version of ass -git pull - -# Rebuild the container with the new changes (uncomment the 2nd part if the update requires refreshing the config) -docker-compose up --force-recreate --build -d && docker image prune -f # && docker-compose exec ass npm run setup && docker-compose restart +# Pull the latest version of ass and rebuild the image +git pull && docker compose build --no-cache && docker compose up -d ``` -- `--force-recreate` will force the container to rebuild -- `--build` will build the image from the latest changes in the directory -- `-d` will run the container in the background -- `docker image prune -f` will remove old images that are no longer used by any containers -- *These descriptions were suggested by [CoPilot], feel free to revise if necessary.* - #### What else should I be aware of? - `docker-compose` exposes **five** volumes. These volumes let you edit the config, view the auth or data files, or view the `uploads/` folder from your host. diff --git a/compose.yaml b/compose.yaml index 0ca397e..e9e9660 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,12 +1,15 @@ -# ass Docker compose.yaml v0.1.2 +# ass Docker compose.yaml v0.2.0 # authors: # - tycrek (https://tycrek.com/) # - Zusier (https://github.com/Zusier) +# +# This file is designed to follow the latest Compose specification, defined here: https://github.com/compose-spec/compose-spec/blob/master/spec.md +# Specific thing(s) to note: +# - The filename, `compose.yaml`: "The default path for a Compose file is compose.yaml (preferred)" (https://github.com/compose-spec/compose-spec/blob/master/spec.md#compose-file) services: ass: build: . - command: npm start container_name: ass-docker restart: unless-stopped user: 1001:1001 @@ -25,7 +28,6 @@ services: source: ./data.json target: /opt/ass/data.json tmpfs: /tmp # temp files such as uploads are stored here - working_dir: /opt/ass tty: true environment: - NODE_ENV=production # for production diff --git a/install/docker-linux.sh b/install/docker-linux.sh index bab7209..727e134 100755 --- a/install/docker-linux.sh +++ b/install/docker-linux.sh @@ -21,21 +21,15 @@ chown -R 1001:1001 config.json auth.json data.json uploads share chmod -R 774 config.json data.json uploads share # Wait for user to confirm -echo "Continuing will run docker-compose. Continue? (Press Ctrl+C to abort)" +echo "Continuing will run docker compose. Continue? (Press Ctrl+C to abort)" read -n 1 -s -r -p "Press any key to continue..." echo Running setup... -# docker-compose up -d -docker-compose up -d && \ - -# Run setup within the container -docker-compose exec ass npm run setup && \ - -# Restart the container when complete -docker-compose restart && \ +# Bring up the container and run the setup +docker compose up -d && docker compose exec ass npm run setup && docker compose restart # Done! echo "ass-docker for Linux installed!" echo "Run the following to view commands:" -echo "$ docker-compose logs -f --tail=50 --no-log-prefix ass" +echo "$ docker compose logs -f --tail=50 --no-log-prefix ass" diff --git a/install/docker-windows.bat b/install/docker-windows.bat index 54b0412..34cce34 100644 --- a/install/docker-windows.bat +++ b/install/docker-windows.bat @@ -14,21 +14,15 @@ if not exist "./auth.json" echo. >> "./auth.json" if not exist "./data.json" echo. >> "./data.json" REM Wait for user to confirm -ECHO Continuing will run docker-compose. Continue? (Press Ctrl+C to abort) +ECHO Continuing will run docker compose. Continue? (Press Ctrl+C to abort) PAUSE ECHO Running setup... -REM docker-compose up -d -docker-compose up -d && - -REM Run setup within the container -docker-compose exec ass npm run setup && - -REM Restart the container when complete -docker-compose restart && +REM Bring up the container and run the setup +docker compose up -d && docker compose exec ass npm run setup && docker compose restart REM Done! ECHO ass-docker for Windows installed! ECHO Run the following to view commands: -ECHO > docker-compose logs -f --tail=50 --no-log-prefix ass +ECHO > docker compose logs -f --tail=50 --no-log-prefix ass diff --git a/src/ass.ts b/src/ass.ts index 78113ec..c6d357a 100644 --- a/src/ass.ts +++ b/src/ass.ts @@ -15,7 +15,7 @@ import { path, log, getTrueHttp, getTrueDomain } from './utils'; //#region Setup - Run first time setup if using Docker (pseudo-process, setup will be run with docker exec) import { doSetup } from './setup'; const configPath = path('config.json'); -if (!fs.existsSync(configPath)) { +if (!fs.existsSync(configPath) || fs.readFileSync(configPath).toString().length === 0) { doSetup(); // @ts-ignore return; diff --git a/src/utils.ts b/src/utils.ts index 9ad9579..c4ff4df 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -18,7 +18,7 @@ try { var { useSsl, port, domain, isProxied, diskFilePath, s3bucket, s3endpoint, s3usePathStyle } = require('../config.json'); // skipcq: JS-0239, JS-0102 } catch (ex) { // @ts-ignore - if (ex.code !== 'MODULE_NOT_FOUND') console.error(ex); + if (ex.code !== 'MODULE_NOT_FOUND' || !ex.toString().includes('Unexpected end')) console.error(ex); } export function getTrueHttp() {