Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[bumpversion]
current_version = 2.8.2
current_version = 2.8.3dev
commit = True
tag = False
tag_name = {new_version}
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<release>[a-z]+)?
serialize =
serialize =
{major}.{minor}.{patch}{release}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = alpha
values =
values =
dev
alpha

[bumpversion:file:setup.cfg]

56 changes: 56 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Docker

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+' # Exclude pre-releases
branches:
- main

jobs:
docker:
runs-on: ubuntu-latest
env:
USER: sdss
APP: marvin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set docker tags
id: set-tags
run: |
echo TAG_LATEST=$USER/$APP:latest >> $GITHUB_OUTPUT
if [[ $GITHUB_REF == refs/heads/main ]]
then
echo TAGS=$USER/$APP:latest >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/heads/* ]]
then
BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's/[\/]/_/g')
echo TAGS=$USER/$APP:$BRANCH >> $GITHUB_OUTPUT
else
echo TAGS=$USER/$APP:${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
fi
- name: Show tags
run: echo ${{ steps.set-tags.outputs.TAGS }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
push: true
tags: |
ghcr.io/${{ steps.set-tags.outputs.TAGS }}
ghcr.io/${{ steps.set-tags.outputs.TAG_LATEST }}
context: docker
file: docker/Dockerfile
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Marvin's Change Log
===================


[2.8.3] - 2025/06/12
--------------------
- Removed header UI user login to fix bug in web deploy
- Updated docker build to fix deps issues
- Adding docker github action

[2.8.2] - 2025/02/05
--------------------
- Updating build to comply with PEP 625
Expand Down
7 changes: 5 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ RUN pip install --no-cache-dir ".[web,db]"

# Resolve some dependency issues
RUN pip install gunicorn
RUN pip install "jinja2<3.1"
RUN pip install "packaging<21"
RUN pip install "itsdangerous==2.0.1"
RUN pip install "pillow<10"
RUN pip install "marshmallow<4.0.0"

# Create the log directory and ensure it's writable
RUN mkdir -p /tmp/marvin/logs && \
Expand All @@ -47,6 +46,10 @@ RUN chmod -R 755 /app/python/marvin/web
# Set environment variables
ENV FLASK_APP="marvin.web.uwsgi_conf_files.app:app"

# Set a label
LABEL org.opencontainers.image.source=https://github.com/sdss/marvin
LABEL org.opencontainers.image.description="marvin production image"

# Change to python dir
WORKDIR /app/python

Expand Down
49 changes: 49 additions & 0 deletions docker/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Set the working directory in the container
WORKDIR /app

# Install library files
RUN apt-get update && \
apt-get install -y --no-install-recommends git libpq-dev gcc build-essential mime-support && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Copy the repo contents into the container
COPY ./ /app

# Install any needed packages
RUN pip install --no-cache-dir ".[web,db]"

# Resolve some dependency issues
RUN pip install gunicorn
RUN pip install "itsdangerous==2.0.1"
RUN pip install "pillow<10"
RUN pip install "marshmallow<4.0.0"

# Create the log directory and ensure it's writable
RUN mkdir -p /tmp/marvin/logs && \
chmod -R 755 /tmp/marvin

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Copy the gunicorn config file into the container
COPY docker/gunicorn_config.py /app/python/gunicorn_config.py

# Create the marvin config file
RUN mkdir -p /root/.marvin && chmod -R 755 /root/.marvin
RUN echo "use_sentry: False\nadd_github_message: False\ncheck_access: False" > /root/.marvin/marvin.yml

# Update permissions
RUN chmod -R 755 /app/python/marvin/web

# Set environment variables
ENV FLASK_APP="marvin.web.uwsgi_conf_files.app:app"

# Change to python dir
WORKDIR /app/python

# Run the application with uWSGI
CMD ["gunicorn", "-c", "gunicorn_config.py", "marvin.web.uwsgi_conf_files.app:app"]
11 changes: 10 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,13 @@ The final web application is available at `localhost:8080/marvin`
By default the marvin docker build will checkout the latest `main` branch of marvin on github and tag the image as `marvin:latest`. To
change this to a specific branch or tag of marvin, e.g. `2.8.0` or `branch_name`, set the `MARVIN_TAG` environment variable. Then
rebuild the system with `docker compose up --build`. This will checkout that branch or tag of the marvin repository and create
a new marvin docker image with that tag name.
a new marvin docker image with that tag name.

## Developer Notes

To run the local developer docker, run the following command from the top level marvin project directory:
```bash
docker compose -f docker/docker-compose-dev.yml up --build
```

If you do not have a local postgres manga database, you can create a tunnel to the manga db at JHU.
56 changes: 56 additions & 0 deletions docker/docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: '3.9'
name: marvin
services:
nginx:
container_name: nginx
image: nginx:latest
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- socket_logs:/tmp/marvin
- web_assets:/usr/share/nginx/html
ports:
- 8080:80
depends_on:
- marvin
networks:
- frontend

redis:
container_name: redis
image: redis:latest
networks:
- backend

marvin:
container_name: marvin
build:
context: ..
dockerfile: docker/Dockerfile.dev
args:
MARVIN_TAG: ${MARVIN_TAG:-main}
image: marvin:${MARVIN_TAG:-latest}
ports:
- 8000:8000
volumes:
- ${SAS_BASE_DIR}:/root/sas/
- $HOME/.pgpass:/root/.pgpass
- socket_logs:/tmp/marvin
- web_assets:/app/python/marvin/web
environment:
- SESSION_REDIS=redis://redis:6379
- MARVIN_BASE=marvin
- PUBLIC_SERVER=True
- MANGADB_CONFIG=docker
networks:
- backend
- frontend
depends_on:
- redis

networks:
backend:
frontend:

volumes:
socket_logs:
web_assets:
2 changes: 2 additions & 0 deletions docker/gunicorn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
socket_dir = os.getenv("MARVIN_SOCKET_DIR", '/tmp/marvin')
bind = [f"unix:{socket_dir}/marvin.sock", "0.0.0.0:8000"]
workers = 1
worker_class = "gthread"
threads = 8
daemon = False
errorlog = os.path.join(os.getenv("MARVIN_LOGS_DIR", '/tmp/marvin/logs'), 'marvin_app_error.log')
accesslog = os.path.join(os.getenv("MARVIN_LOGS_DIR", '/tmp/marvin/logs'), 'marvin_app_access.log')
29 changes: 0 additions & 29 deletions python/marvin/web/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,6 @@
</li>
</ul>
</div>
{% elif not current_user.is_authenticated %}
<!-- Login -->
{# Login #}
<div class='navbar-login'>
<ul class="nav navbar-nav navbar-right">
<li id='login-drop' class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-sign-in fa-fw" aria-hidden="true"></i><b>Login</b> <span class="caret"></span></a>
<ul id="login-dp" class="dropdown-menu">
<li>
{{login()}}
</li>
</ul>
</li>
</ul>
</div>
{% else %}
<!-- User Preferences -->
{# User Preferences Post Login #}
<div class='navbar-userprefs'>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Welcome, {{current_user.username}} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{url_for('users_page.User:preferences')}}"><i class="fa fa-cog fa-fw" aria-hidden="true"></i> Preferences</a></li>
<li class="divider"></li>
<li><a href="{{url_for('index_page.logout')}}"><i class="fa fa-sign-out fa-fw" aria-hidden="true"></i> Logout</a></li>
</ul>
</li>
</ul>
</div>
{% endif %}

</div>
Expand Down
4 changes: 2 additions & 2 deletions python/marvin/web/web_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def check_request_for_release(request):
def configFeatures(app):
''' Configure Flask Feature Flags '''

app.config['FEATURE_FLAGS']['public'] = True if config.access == 'public' else False
app.config['FEATURE_FLAGS']['public'] = True


def check_access():
''' Check the access mode in the session '''

# check if on public server
public_server = request.environ.get('PUBLIC_SERVER', None) == 'True'
public_server = request.environ.get('PUBLIC_SERVER', True) == 'True'
public_flag = public_server or current_app.config['FEATURE_FLAGS']['public']
current_app.config['FEATURE_FLAGS']['public'] = public_server
public_access = config.access == 'public'
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = sdss-marvin
version = 2.8.2
version = 2.8.3dev
author = The Marvin Developers
author_email = havok2063@hotmail.com
description = Toolsuite for dealing with the MaNGA dataset
Expand Down Expand Up @@ -149,6 +149,7 @@ web=
redis>=3.3
#uwsgi>=2.0.15 # install with "conda install -c conda-forge uwsgi" instead
# added for rtd issues
marshmallow<4.0
validators>=0.10.3
intervals>=0.8.0
db=
Expand Down
Loading