This repository has been archived by the owner on Sep 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
146 changed files
with
815 additions
and
417 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,76 @@ | ||
# Quickstart | ||
|
||
1. Install [docker](https://docs.docker.com/engine/install/) | ||
2. Init swarm: `docker swarm init` | ||
3. Add docker-configs from `fairdata-secrets` repo | ||
4. Update `/etc/hosts` with `0.0.0.0 metax.fd-dev.csc.fi` | ||
5. Deploy with `docker stack deploy -c docker-compose.yml --resolve-image=always --with-registry-auth metax-dev` | ||
6. Init Metax `docker exec $(docker ps -q -f name=metax-dev_metax-web) python manage.py first_time_setup` | ||
|
||
# Local development with Docker-swarm | ||
|
||
## Building metax-image | ||
After installing [Docker prerequisites](docker-prerequisites.md), Initialize the Swarm: | ||
|
||
After installing [Docker prerequisites](docker-prerequisites.md), build the metax-web docker image with the following command: | ||
`docker swarm init` | ||
|
||
`docker build -t fairdata-docker.artifactory.ci.csc.fi/fairdata-metax-web .` | ||
## Running the stack locally | ||
|
||
<!-- ## Building httpd-image | ||
Append your local `/etc/hosts` file with: | ||
|
||
`docker build -t fairdata-docker.artifactory.ci.csc.fi/fairdata-metax-httpd -f containers/apache-image.Dockerfile .` --> | ||
`0.0.0.0 metax.fd-dev.csc.fi` | ||
|
||
## Pushing metax-image to Artifactory | ||
The default stack requires docker-configurations that can be found from `fairdata-secrets` repository. If there is no | ||
access to that repo, refer the next section. When the required configurations are created, the stack can be deployed | ||
from the repository root with: | ||
|
||
`docker push fairdata-docker.artifactory.ci.csc.fi/fairdata-metax-web` | ||
`docker stack deploy -c docker-compose.yml --resolve-image=always --with-registry-auth metax-dev` | ||
|
||
<!-- ## Pushing httpd-image to Artifactory | ||
After all the services has been started, Metax is available from `metax.fd-dev.csc.fi`. This stack contains the common | ||
Fairdata nginx proxy. | ||
|
||
`docker push fairdata-docker.artifactory.ci.csc.fi/fairdata-metax-httpd` --> | ||
__NOTE__: Docker for Mac has a bug that prevents the required configurations to be deployed to metax-web container. To | ||
work around this, refer the `Required environmental variables` section in [README](/README.md) | ||
|
||
## Running the stack without predefined docker-configs | ||
|
||
## Running the stack locally | ||
Development setup without pre-required docker-configurations can be run with: | ||
|
||
In the repository root, run | ||
`docker stack deploy -c config-swap-stack.yml --resolve-image=always --with-registry-auth metax-dev` | ||
|
||
`docker stack deploy -c docker-compose.yml --resolve-image=always --with-registry-auth metax-dev` | ||
After all the services has been started, Metax is available from `0.0.0.0:8008`. This stack allows the environment | ||
variables to be changed without re-deploying the whole stack. To add certain docker-config to metax-web container: | ||
|
||
This stack contains the common Fairdata nginx proxy. | ||
`docker service update --config-add source=<CONFIG-NAME>,target=/code/metax_api/settings/.env metax-dev_metax-web` | ||
|
||
## Running the stack without predefined docker-configs | ||
To change existing configuration in metax-web container: | ||
|
||
`docker stack deploy -c config-swap-stack.yml --resolve-image=always --with-registry-auth metax-dev` | ||
`docker service update --config-rm <CONFIG-NAME> --config-add source=<NEW-CONFIG-NAME>,target=/code/metax_api/settings/.env metax-dev_metax-web` | ||
|
||
## Running Metax management commands | ||
## Building related images | ||
|
||
To run Metax management commands, locate the running metax-dev_metax-web container and open terminal inside it with: | ||
Docker image for metax-web can be built with the following command: | ||
|
||
`docker exec -it <container-name> bash` | ||
`docker build -t fairdata-docker.artifactory.ci.csc.fi/fairdata-metax-web .` | ||
|
||
Image for metax-httpd can be build with: | ||
|
||
`docker build -t fairdata-docker.artifactory.ci.csc.fi/fairdata-metax-httpd -f httpd.dockerfile .` | ||
|
||
## Pushing images to Artifactory | ||
|
||
Ensure that you are logged in to Artifactory: | ||
|
||
## Adding docker-config to the stack | ||
`docker login fairdata-docker.artifactory.ci.csc.fi` | ||
|
||
`docker service update --config-add source=metax-web-stable-config,target=/code/metax_api/settings/.env metax-dev_metax-web` | ||
Push commands for metax-web and metax-httpd respectively: | ||
|
||
## Swapping docker-config in the stack | ||
`docker push fairdata-docker.artifactory.ci.csc.fi/fairdata-metax-web` | ||
|
||
`docker service update --config-rm <docker-config-name> --config-add source=<docker-config-name>,target=/code/metax_api/settings/.env metax-dev_metax-web` | ||
`docker push fairdata-docker.artifactory.ci.csc.fi/fairdata-metax-httpd` | ||
|
||
## Running Metax management commands | ||
|
||
To run Metax management commands, locate the running metax-dev_metax-web container (can be done with `docker container ls`) | ||
and open terminal inside it with: | ||
|
||
`docker exec -it <container-name> bash` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM httpd:2.4 | ||
|
||
RUN apt-get update && apt-get install -y ca-certificates libapache2-mod-auth-openidc | ||
|
||
RUN echo "Include /usr/local/apache2/conf/extra/httpd-metax.conf" >> /usr/local/apache2/conf/httpd.conf | ||
|
||
EXPOSE 8080 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.