Skip to content

Commit da4ff97

Browse files
authored
Merge pull request #411 from DasSkelett/fix/loggingini
2 parents 70b1583 + 562b275 commit da4ff97

File tree

6 files changed

+37
-29
lines changed

6 files changed

+37
-29
lines changed

.github/workflows/pytest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ jobs:
2020
pip install -r requirements-tests.txt
2121
- name: pytest
2222
run: |
23+
cp logging.ini.example logging.ini
2324
pytest -v tests/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ local/
1111

1212
config.ini
1313
alembic.ini
14+
logging.ini
1415
.last_head
1516
.frozen-requirements.txt
1617

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ If you use systemd/spacedock.target or Docker, this will be done automatically f
9494

9595
**Configure SpaceDock**
9696

97-
$ cp alembic.ini.example alembic.ini
9897
$ cp config.ini.example config.ini
98+
$ cp alembic.ini.example alembic.ini
99+
$ cp logging.ini.example logging.ini
99100

100101
Edit config.ini and alembic.ini to your liking.
101102

README_DOCKERFILE.md

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,60 @@
11
# How to use the Dockerfile
22
It should be assumed that all commands should be run from the project root, unless otherwise noted.
3-
Additionally, depending on your platform and how you've setup Docker, ```docker``` commands might need to be run as the ```root``` user or prefaced with ```sudo``` to work properly.
3+
Additionally, depending on your platform and how you've setup Docker, `docker` commands might need to be run as the `root` user or prefaced with `sudo` to work properly.
44

55
## Quickstart
6-
```
7-
docker-compose up
6+
```sh
7+
./start-server.sh
88
```
99
Admin Credentials: admin:development
1010

1111
User Credentials: user:development
1212

1313
## Install Docker
14-
See [https://www.docker.com/](docker.com) for instructions on installing Docker for your platform.
14+
See <https://www.docker.com/> for instructions on installing Docker for your platform.
1515

1616
## Configure, Build, and Run
17-
The dockerfile will automatically copy the config.ini.example and alembic.ini.example to config.ini and alembic.ini, respectfully. If you wish to provide your own, copy them like below and edit as you will.
18-
```
19-
cp config.ini.example config.ini && cp alembic.ini.example alembic.ini
17+
The launch script will automatically copy the `config.ini.example`, `alembic.ini.example` and `logging.ini.example` to `config.ini`, `alembic.ini` and `logging.ini`, respectively.
18+
If you wish to provide your own, copy them like below and edit as you will.
19+
```sh
20+
cp config.ini.example config.ini && cp alembic.ini.example alembic.ini && cp logging.ini.example logging.ini
2021
```
2122

22-
To create all the required containers and startup spacedock, run
23-
```
24-
docker-compose up
23+
To create all the required containers and startup SpaceDock, run
24+
```sh
25+
./start-server.sh
2526
```
26-
This will automatically link ```your_project_root``` to ```/opt/spacedock``` on the container.
27-
This means that changes you make locally to files in your project folder will be instantly synced to and reflected in the container.
28-
This will also forward port 8000 of your docker contianer to port 8000 of your docker-machine, so you'll be able to browse to your local server.
29-
Furthermore, this will also give the ```spacedock``` name to your container, which will make managing it easier.
27+
This will automatically link `./` to `/opt/spacedock` in the backend container, as well as `./spacedock-db` into the database container and `./storage` into the frontend container.
28+
This means that changes you make locally to files in your project folder will be instantly synced to and reflected in the container (however CSS and JS files need to be rebuilt before the changes take effect).
29+
This will also forward port 5080 of the nginx container to port 5080 of your host, so you'll be able to browse to your local server.
30+
31+
The following containers will be started:
32+
33+
| docker-compose service name | container name | function |
34+
| --------------------------- | -------------- | -------- |
35+
| backend | spacedock_backend_1 | Flask development server |
36+
| db | spacedock_db_1 | PostgreSQL database |
37+
| redis | spacedock_redis_1 | Redis in-memory Key-Value store (required for Celery) |
38+
| frontend | spacedock_frontend_1 | NGINX frontend acting as proxy to the backend and serving static files |
39+
| adminer | spacedock_adminer_1 | Database management UI for development and debugging |
3040

31-
You might run into a problem where changes to the Dockerfile are not reflected run you run ```docker-compose up```. This is expected. Run ```docker-compose rm -f && docker-compose build``` to force the containers to be rebuilt.
41+
To interact with a container using the `docker` command, you need to use the container name.
42+
To interact using `docker-compose`, you need to use the service name and be in the repository directory or any subdirectory.
3243

3344
## Connecting
34-
If you are on a mac or another environment that requires the use of docker-machine, then you must connect to the local server via that docker machine rather than localhost.
45+
If you are on macOS or another environment that requires the use of docker-machine, then you must connect to the local server via that docker machine rather than localhost.
3546

36-
To find out the correct IP to use in your browser, use ```docker-machine ip```. You can then browser to port 5000 of that IP and all should be well.
47+
To find out the correct IP to use in your browser, use `docker-machine ip`. You can then browse to port 5080 of that IP and all should be well.
3748

3849
There are two default accounts, an admin and a regular user:
3950
Admin Credentials: admin:development
4051
User Credentials: user:development
4152

4253
## Starting and Stopping
43-
If you want to stop your container without losing any data, you can simply do ```docker-compose stop```.
44-
Then, to start it back up, do ```docker-compose up```.
45-
46-
## Enabling Gunicorn
47-
By default, the flask debug server is used to facilitate local development, as it handles serving static files better than gunicorn and has the Werkzeug debugger enabled. To enable using Gunicorn, which is recommended for a production environment, you should set the ```USE_GUNICORN``` environment variable when starting the docker container. Do so either in your user's .bashrc file or on the command-line like below.
48-
49-
```
50-
USE_GUNICORN=true docker-compose up
51-
```
54+
If you want to stop your container without losing any data, you can simply do `docker-compose stop`.
55+
Then, to start it back up, do `docker-compose up`.
5256

5357
## Odd and Ends
54-
```
55-
docker exec -i -t spacedock bash # Start a bash shell in the spacedock container
58+
```sh
59+
docker-compose exec backend /bin/bash # Start a bash shell in the backend container
5660
```
File renamed without changes.

start-server.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -e
44
# Create default config files, if needed
55
test -f config.ini || cp config.ini.example config.ini
66
test -f alembic.ini || cp alembic.ini.example alembic.ini
7+
test -f logging.ini || cp logging.ini.example logging.ini
78

89
# start the docker
910
if [[ -z "$(pgrep dockerd)" ]];

0 commit comments

Comments
 (0)