> Update: There is no requirement of Elasticsearch in the new Forem
Setting up Forem using Docker is one of the easiest ways to have Development Instance π. If you already have Docker and Docker-Compose, you can install a development instance with a single command, but you guys, you don't deserve the fun π => You can check out the last section of this post and find the Golden Command
For the rest, let us do it but with fun π₯³π₯³. Do you remember this song? One Kiss? πΆ Which made Dua Lipa, the Dua Lipa?
One command is all it takes
fallin' love with Forem
Possibilities
I look Like all you need
Fortunately, if you never installed Docker or Docker-Compose, don't worry π΅, I'm here for you. Open Youtube in the new tab and play this "One Kiss π by Dua Lipa" in the background and copy-paste my commands.
Installing Docker using Repository
All the commands are from the official documentation of Docker itself, so don't worry, just copy-paste. In case if you don't believe me π€, click here, this will redirect you to the official documentation.
- Updating and Installing some necessaries
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
- Adding Dockerβs official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- Setting up the stable repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
- Updating and Installing Docker Engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
- Testing the Docker Installation
sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
With this our Docker installation was done π, now let's turn up towards the Docker-Compose Installation πͺ.
In case, you are facing any errors!β οΈ Click Here, choose your OS and follow the official instructions π©.
Installing Docker Compose
As I mentioned earlier, I am following the official documentation, so you can copy and paste. In case, if you want to follow them by yourself ππ€, click here
- Downloading the current stable Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- Giving executable permissions to the binary
sudo chmod +x /usr/local/bin/docker-compose
- Verifying the Installation
docker-compose --version
For some unknown reason, if you end up with an errorπ§ try repeating the docker-compose installation only. If the error persisted, I would suggest you reinstall your OS π€. You should not get an errorπ€.
Time to change the Beat
Enough of One Kiss. Time for some awesome beats, check this out Strobe by Deabmau5 => Youtube link to Strobe
Now we have Docker and Docker Compose installed in our local machine, but there is one more thing left for us to do π³. We forget to fork and download the Forem code into our local machine from the GitHub π€―.
I knew the response of many of you would be π€¬, but bear with me π».
Forking and Downloading the Forem code
Don't make me repeat it again π , play the Strobe by Deadmau5 in the background π€. I knew you can't make a coffee whenever you have to wait for some time, here, the Docker can consume enough time to bore you up.
- Downloading the repository to you local machine
git clone https://github.com/forem/forem.git
- Enter into the downloaded Forem folder
cd forem
- Creating .env file using the template .env_sample
cp .env_sample .env
The awaited Golden Command
π₯΅π₯΅π₯΅ You did nothing, but yeah, I assume you are horrified by the way I demonstrate this π₯Ά
- Running Forum with Docker Via Docker-Compose
bin/container-setup
This command will do its job, you just keep an eye on the terminal by listening to strobe π€π€. You will really appreciate the work done by the team Forum, they really made it easy for us (non-developers), but sure you can call yourself a DEV after this.
- That's it! Navigate to http://localhost:3000
Any improvements π¨βπ¬, suggestions π€¦ββοΈ, and issues β οΈ are welcomed in the comment section. This is not formal documentation for me to shy out, load them out, and let us change it according to our needs.
With this, we have our own Development Instance. I will catch you in the next post π¨βπ» π©βπ» (Devs), possibly with something similar to this but in a different environment.
Top comments (24)
This is all i have after follow your tutorial, but don't know why i alway get blank page after i try to login with admin@forem.local/password
forem.dev/remoteimages/uploads/art...
From the looks of it, I guess you are hosting your Forem on a VPS. So, in the
.env
file, replace thelocalhost:3000
with<yourIP>:3000
And also, make sure that port 3000 is open to public => some configurations.
thanks, another question is there any way to increase image size when upload? i receive "The string did not match the expected pattern." every time. And can i Block permission to write a new post to user, only Admin can write and user can comment only? I use Dokku, t2d
You can create a
feature request
post upon this query, but for now, it is not possible without the modifications of the code base.Can i display this on my Home Page Forever?
forem.dev/remoteimages/uploads/art...
here the same, what can i do with the port 3000 ?
After Login with (admin@forem.local/password) i have a blank page.
Yes i edit the "localhost" to the the VPS IP:
And the port "3000" is free:
and then i restart the server and start "forem" new.
But the Blank Site start again :(
Please tell me how to solve the problem with blank page after trying to login? CentOS Linux 7.8. Thank you!
Blank page? Can I have a look at the error screenshot?
forem.dev/remoteimages/uploads/art...
Configure your env variables, especially
forem.dev/tmedivh/i-am-trying-to-d...
A very nice post.
I've follow you all instruction in this post to install forem. But I'm getting an error. Can you give me an way to fix this error? The error is when I type
bin/container-setup
I'm getting this error:use these commands in order.
sudo groupadd docker
sudo usermod -aG docker $USER
logout and login if PC or if it is a VM restart your VM or VPS
newgrp docker
sudo systemctl enable docker
sudo service docker restart
run this command to verify your docker:
docker run hello-world
Hey @akhil , thanks for this awesome guide.
Just one question, I'm planning to use docker to selfhost, but i see that the git clone command is not the self host repo.
Would this cause any issues?
Thanks
You can use the official repo: github.com/forem/forem
Hey Akhil, awesome article you have!
How much server resources do you estimate forem would need for a couple hundred users? I'm planning on deploying my own Forem to DO. π
Today, most of the services provided by many cloud hosting companies are scalable, keeping this fact in mind it is always better to start with the minimum requirements for any project; at least this is my opinion.
So, I would suggest you start with 4GB Ram, 2Core CPU droplet, for initial production, it can easily maintain 100 users. If you feel like cost doesn't matter, you can prefer 8GB ram and 4Core CPU, anything above this will be an overkill. After all after a particular stage in open sources projects like Forem, the main issue will be in regarding storing data and backing them up safely.
Hope you got some useful info and let me know if you have your Forem instance :)
Thanks, Akhil!
When I login to my Forem, with admin@forem.local/password, I get blank page. I only copy .env_sample to .env. In .env file, I replaced all localhost with myIP, changed FOREM_OWNER_SECRET, COMMUNITY_NAME, DEFAULT_EMAIL, SESSION_KEY.
Beside that, some containers auto stop.
Anyways, I'm actually working on a SaaS project to make the instllation process more user friendly. Even though the SaaS is not ready for offcial release, it can be used to install Forem. (The core working principles were ready and under working condition)
If you are interested in installing Forem, let me know, I will provide you access and necessary guidance to use the SaaS to install your Forem.
How to tranfer devlopment env to production env?
forem.dev/remoteimages/uploads/art...
Presently the Dev or Forem team is working on it, I would suggest you to wait for a while.