Skip to content

Commit

Permalink
[Documentation] Update docs, docker-compose configs for ARM64 (Center…
Browse files Browse the repository at this point in the history
…ForOpenScience#10069)

* Initial update for the README-docker-compose file

* Another update

* Additional updates for the readme file

* Added more information to the read

* Proposed changes to the docker-compose and docker-compose-dist.override files to make themmore maintailable

* Add ARM64 DC.yml override
- Refactor other docker-compose ymls
closes CenterForOpenScience#10068

* Reorganize README-docker-compose for ARM64
closes CenterForOpenScience#10067

Co-authored-by: Brian Pilati <[email protected]>
  • Loading branch information
mfraezz and bp-cos authored Sep 22, 2022
1 parent 4efebcb commit 50ce7e3
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 3 deletions.
79 changes: 77 additions & 2 deletions README-docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
&& sudo chown root:wheel $libdir/$file \
&& sudo launchctl load $libdir/$file
```

- Ubuntu
- Add loopback alias
`sudo ifconfig lo:0 192.168.168.167 netmask 255.255.255.255 up`
Expand Down Expand Up @@ -73,7 +74,7 @@
- `$ docker-compose up --force-recreate --no-deps preprints`

1. Application Settings
- e.g. OSF & OSF API local.py
- e.g. OSF & OSF API local.py

`$ cp ./website/settings/local-dist.py ./website/settings/local.py`

Expand All @@ -95,6 +96,36 @@

_NOTE: Similar docker-compose.\<name\>.env environment configuration files exist for services._

#### Special Instructions for Apple Chipset (M1, M2, etc.) and other ARM64 architecture

* _NOTE: The `elasticsearch`, `elasticsearch6`, and `sharejs` containers are incompatible with ARM64._

- Running containers with docker-compose

- Copy an ARM64-compatible configuration to `docker-compose.override.yml`:

`$ cp ./docker-compose-dist-arm64.override.yml ./docker-compose.override.yml`

- In `webite/settings/local.py`, disable `SEARCH_ENGINE`
```python
# SEARCH_ENGINE = 'elastic'
SEARCH_ENGINE = None
```

- Building the Docker image

- If you wish to use an OSF image other than the latest `develop-arm64`:
- Build the image
```bash
$ cd <path-to-osf.io>
$ git checkout <master|develop|etc>
$ docker buildx build --platform linux/arm64 -t osf:<branch>-arm64 .
```
- In `docker-compose.override.yml`, replace any `quay.io/centerforopenscience/osf:develop-arm64` with the locally-tagged image above:
```yml
image: osf:<branch>-arm64
```

## Application Runtime

* _NOTE: Running docker containers detached (`-d`) will execute them in the background, if you would like to view/follow their console log output use the following command._
Expand Down Expand Up @@ -141,6 +172,50 @@
$ docker-compose logs -f --tail 100 web
```

### Helpful aliases

- Start all containers
```bash
alias dcsa="docker-compose up -d assets admin_assets mfr wb fakecas sharejs worker elasticsearch elasticsearch6 web api admin preprints"
```

- Shut down all containers
```bash
alias dchs="docker-compose down"
```

- Attach to container logs
- dcl <container>. Ie. `dcl web` will log only the web container
```bash
alias dcl="docker-compose logs -f --tail 100 "
```

- Run migrations (Starting a fresh database or changes to migrations)
```bash
alias dcm="docker-compose run --rm web python3 manage.py migrate"
```

- Download requirements (Whenever the requirements change or first-time set-up)
```bash
alias dcreq="docker-compose up requirements mfr_requirements wb_requirements"
```

- Restart the containers
- `$ dcr <container>`. Ie. `dcr web` will restart the web container
```bash
alias dcr="docker-compose restart -t 0 "
```

- Start the OSF shell (Interactive python shell that allows working directly with the osf on a code level instead of a web level.)
```bash
alias dcosfs="docker-compose run --rm web python3 manage.py osf_shell"
```

- List all these commands
```bash
alias dchelp="echo 'dcsa (start all), dchs (hard stop), dcl (logs), dcm (migrations), dcr (restart a process), dcosfs (OSF Shell), dcreq(requirements)'"
```

## Running arbitrary commands

- View logs: `$ docker-compose logs -f --tail 100 <container_name>`
Expand Down Expand Up @@ -346,4 +421,4 @@ wb:
### Running Collections
To run collections, you must uncomment COLLECTIONS_ENABLED=true in docker-compose.yml under ember_osf_web, then recreate your ember and web containers.
To run collections, you must uncomment COLLECTIONS_ENABLED=true in docker-compose.yml under ember_osf_web, then recreate your ember and web containers.
50 changes: 50 additions & 0 deletions docker-compose-dist-arm64.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Reference README-docker-compose.md for instructions.

version: '3.4'

services:

#######
# OSF #
#######

requirements:
image: quay.io/centerforopenscience/osf:develop-arm64
platform: linux/arm64

assets:
image: quay.io/centerforopenscience/osf:develop-arm64
platform: linux/arm64
# Need to allocate tty to be able to call invoke for requirements task
tty: true

admin_assets:
image: quay.io/centerforopenscience/osf:develop-arm64
platform: linux/arm64
# Need to allocate tty to be able to call invoke for requirements task
tty: true

worker:
image: quay.io/centerforopenscience/osf:develop-arm64
platform: linux/arm64
# Need to allocate tty to be able to call invoke for requirements task
tty: true

admin:
image: quay.io/centerforopenscience/osf:develop-arm64
platform: linux/arm64
# Need to allocate tty to be able to call invoke for requirements task
tty: true

api:
image: quay.io/centerforopenscience/osf:develop-arm64
platform: linux/arm64
# Need to allocate tty to be able to call invoke for requirements task
tty: true

web:
image: quay.io/centerforopenscience/osf:develop-arm64
platform: linux/arm64
# Need to allocate tty to be able to call invoke for requirements task
tty: true

3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ services:
###################

elasticsearch:
platform: linux/amd64
image: elasticsearch:2
ports:
- 9200:9200
Expand Down Expand Up @@ -514,4 +515,4 @@ services:
- .osf-pigeon.env
stdin_open: true
volumes:
- /srv
- /srv

0 comments on commit 50ce7e3

Please sign in to comment.