Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for custom tokens #155

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Adding support for custom tokens #155

wants to merge 3 commits into from

Conversation

vsoch
Copy link
Member

@vsoch vsoch commented Mar 2, 2022

Signed-off-by: vsoch vsoch@users.noreply.github.com

Description of the Pull Request (PR):

This PR will be early work to address #154 - and the branch can be tested as follows. First, create a dummy dockerfile that uses this branch, e.g., I could run docker run -v $PWD:/data quay.io/vanessa/expfactory-builder build test-task and then just change the branch:

FROM quay.io/vanessa/expfactory-builder:base

########################################
# Configure
########################################

ENV EXPFACTORY_STUDY_ID expfactory
ENV EXPFACTORY_SERVER localhost
ENV EXPFACTORY_CONTAINER true
ENV EXPFACTORY_DATA /scif/data
ENV EXPFACTORY_DATABASE filesystem
ENV EXPFACTORY_HEADLESS false
ENV EXPFACTORY_BASE /scif/apps
 
ADD startscript.sh /startscript.sh
RUN chmod u+x /startscript.sh

WORKDIR /opt 
RUN git clone -b add/custom-tokens https://github.com/expfactory/expfactory
WORKDIR expfactory 
RUN cp script/nginx.gunicorn.conf /etc/nginx/sites-enabled/default && \
    cp script/nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p /scif/data # saved data
RUN mkdir -p /scif/apps # experiments 
RUN mkdir -p /scif/logs # gunicorn logs 
RUN python3 -m pip install gunicorn
RUN cp expfactory/config_dummy.py expfactory/config.py && \
    chmod u+x /opt/expfactory/script/generate_key.sh && \
    /bin/bash /opt/expfactory/script/generate_key.sh /opt/expfactory/expfactory/config.py
RUN python3 setup.py install
RUN python3 -m pip install pyaml    pymysql psycopg2-binary
RUN apt-get clean          # tests, mysql,  postgres

########################################
# Experiments
########################################


LABEL EXPERIMENT_test-task /scif/apps/test-task
WORKDIR /scif/apps
RUN expfactory install https://github.com/expfactory-experiments/test-task

ENTRYPOINT ["/bin/bash", "/startscript.sh"]
EXPOSE 5000
EXPOSE 80

build it

$ docker build --no-cache -t experiment .
``
And then you can start it headless (or start it without detached and open another terminal to interact with it - up to you!)

```bash
docker run --name experiment -v $PWD/:/scif/data -d -p 80:80 experiment start

Now we can execute commands to interact with the install inside. E.g., list users

docker exec experiment expfactory users --list

there should be a command for --tokens so we can create a text file with line separated tokens (comments are okay)

# tokens.txt
# this is a comment
AAAAAA
BBBBBB

the present working directory is bound to /data so let's ask expfactory to add users from the tokens file there (from the container's point of view):

docker exec experiment expfactory users --tokens /scif/data/tokens.txt
2 users existing or generated from file.

You should then be able to see the data directories in expfactory in the PWD:

$ ls expfactory/
AAAAAA  BBBBBB

And also login via the interface with the tokens (I couldn't test this because I rigorously block cookies)! Also note a more complete variation of these instructions will be added to the expfactory.github.io docs, shown here

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant