The development process for this application requires the following to be set up:
A local (or container) version of MongoDB installed and available. This could be installed directly on your development machine, or running as a docker container. If interested in the container version, see the service entry in the .devcontainer/docker-compose.yml
file.
Ability to build the application as a Docker container. The build file instructions are contained in the Dockerfile
file in the root of the repository.
If using a hosted version of MongoDB in the cloud (for instance Digital Ocean), add any necessary files for authentication such as certificates in the deploy_files
directory at the root of the repo. In this case, the file is called ca-certificate.crt
.
Create both a .Renviron
and .env
files that host specific environment variables that will be used to connect to MongoDB. See the corresponding .Renviron.example
and .env.example
for the expected syntax.
Set up an account on Docker Hub and create a Docker Hub repo to host your container image. In this example, the repo is called rpodcast/rphquizplay
If using Digital Ocean to host the application, you will need an account on that service.
run_dev.R
script in this sub directory. Note that you should set the following to ensure dev mode:options(golem.app.prod = FALSE) # TRUE = production mode, FALSE = development mode
Sys.setenv("GOLEM_CONFIG_ACTIVE" = "dev")
DESCRIPTION
by running usethis::use_package("name_of_package")
or usethis::use_dev_package("name_of_package")
as appropriate.03_deploy.R
if the file is not presentDockerfile
to add the following snippet before the installation of the app package:# copy cert file
RUN mkdir /deploy_files
RUN cp /build_zone/deploy_files/ca-certificate.crt /deploy_files/ca-certificate.crt
RUN rm /build_zone/.Rprofile
RUN rm -rf /build_zone/renv
docker build -t rphquiz .
where rphquiz
is the name of the image (can be any string)docker run --env-file=.env -p 5557:80 --name rphlocal rphquiz
Where rphlocal
is a name for the running container (can be any string)
localhost:5557
docker logs rphlocal
docker tag rphquiz rpodcast/rphquizplay
docker login
and entering your Docker Hub user ID and password at the promptsdocker push rpodcast/rphquizplay
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.