Docker cleanups
- Put docker-compose.yml into version control, no need to make this an example file and complicate things. - Start the docker dev-env osem on port 3000. Just as our documentation says and how we do it in vagrant. - hardcode CONTAINER_USERID so you don't have to have an docker-compose.override.yml if your UID is 1000. - Rename web service/container to osem for clarity in the logs - Keep assets also in a volume in production - warn a bit more prominently about docker-compose.override.yml
This commit is contained in:
parent
f69bb18e79
commit
042d49619c
5 changed files with 24 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -35,7 +35,6 @@ pickle-email-*.html
|
||||||
.env.development
|
.env.development
|
||||||
.env.test
|
.env.test
|
||||||
.env.local
|
.env.local
|
||||||
docker-compose.yml
|
|
||||||
docker-compose.override.yml
|
docker-compose.override.yml
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.byebug_history
|
.byebug_history
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,17 @@ based development environment, based on [docker](https://www.docker.com/) and
|
||||||
[docker-compose](https://docs.docker.com/compose/). Here's a step by step guide
|
[docker-compose](https://docs.docker.com/compose/). Here's a step by step guide
|
||||||
how to set it up.
|
how to set it up.
|
||||||
|
|
||||||
|
**WARNING**: Since we mount the repository into our container, your user id and
|
||||||
|
the id of the osem user inside the container need to be the same. If your user
|
||||||
|
id (`id -u`) is something else than `1000` you can copy the docker-compose
|
||||||
|
override example file and in it, set your user id in the variable
|
||||||
|
*CONTAINER_USERID*.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sed "s/13042/`id -u`/" docker-compose.override.yml.example > docker-compose.override.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
1. Set up the development environment:
|
1. Set up the development environment:
|
||||||
```bash
|
```bash
|
||||||
docker-compose run --rm osem bundle exec rake setup:bootstrap
|
docker-compose run --rm osem bundle exec rake setup:bootstrap
|
||||||
|
|
@ -54,13 +65,6 @@ how to set it up.
|
||||||
docker-compose exec osem_1 /bin/bash -l
|
docker-compose exec osem_1 /bin/bash -l
|
||||||
```
|
```
|
||||||
|
|
||||||
**WARNING**: Since we mount the repository into our container, your user id and the id of the osem user inside the container need to be the same. If your user id (`id -u`) is something else than `1000` you can copy the docker-compose override example file and in it, set your user id in the variable
|
|
||||||
*CONTAINER_USERID*.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp docker-compose.override.yml.example docker-compose.override.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### with Vagrant
|
### with Vagrant
|
||||||
Another option is using [Vagrant](https://www.vagrantup.com/) and [VirtualBox 5.0.10](https://www.virtualbox.org/wiki/Download_Old_Builds_5_0) to create your development environment.
|
Another option is using [Vagrant](https://www.vagrantup.com/) and [VirtualBox 5.0.10](https://www.virtualbox.org/wiki/Download_Old_Builds_5_0) to create your development environment.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Setup the app if it isn't already setup
|
||||||
bundle exec rake setup:bootstrap
|
bundle exec rake setup:bootstrap
|
||||||
foreman start
|
# Start the app
|
||||||
|
foreman start -p 3000
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,15 @@ services:
|
||||||
image: postgres
|
image: postgres
|
||||||
environment:
|
environment:
|
||||||
PGDATA: /var/lib/postgresql/data/pgdata
|
PGDATA: /var/lib/postgresql/data/pgdata
|
||||||
web:
|
osem:
|
||||||
build: .
|
build:
|
||||||
# env_file: dotenv.example
|
context: .
|
||||||
|
args:
|
||||||
|
CONTAINER_USERID: 1000
|
||||||
command: /osem/bin/osem-init.sh
|
command: /osem/bin/osem-init.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 3000:3000
|
||||||
volumes:
|
volumes:
|
||||||
- .:/osem
|
- .:/osem
|
||||||
|
|
@ -7,21 +7,23 @@ services:
|
||||||
PGDATA: /var/lib/postgresql/data/pgdata
|
PGDATA: /var/lib/postgresql/data/pgdata
|
||||||
volumes:
|
volumes:
|
||||||
- database:/var/lib/postgresql/data/pgdata
|
- database:/var/lib/postgresql/data/pgdata
|
||||||
web:
|
osem:
|
||||||
build: .
|
build: .
|
||||||
dockerfile: Dockerfile.production
|
dockerfile: Dockerfile.production
|
||||||
env_file: .env.production # see dotenv.example file
|
env_file: .env.production # see dotenv.example file
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 3000:3000
|
||||||
volumes:
|
volumes:
|
||||||
- .:/osem
|
- .:/osem
|
||||||
- web-data:/osem/public/system
|
- web-data:/osem/public/system
|
||||||
|
- web-assets:/osem/public/assets
|
||||||
- web-logs:/osem/log
|
- web-logs:/osem/log
|
||||||
|
|
||||||
# named volumes to persist data
|
# named volumes to persist data
|
||||||
volumes:
|
volumes:
|
||||||
database:
|
database:
|
||||||
web-data:
|
web-data:
|
||||||
|
web-assets:
|
||||||
web-logs:
|
web-logs:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue